I have 2 Samsung EVO micro SDHC cards that I was using in a Raspberry Pi. I'm now trying to format them on my Macbook Air running Big Sur on Apple Silicon and have tried two methods for formatting, and they ran without errors but the files and partitions remain:
1 – SD Card Formatter – tried both quick format and overwrite format
2 – sudo diskutil partitionDisk /dev/diskN 1 MBR "Free Space" "%noformat%" 100%
(diskN
replaced with disk4
in my case)
Does anyone have any suggestions? I'm hoping I don't have to throw them out and order new ones.
Edit:
I've tried diskutil erasedisk fat32 NONE mbr /dev/disk4
and also with
sudo dd if=/dev/zero count=33 of=/dev/disk4
first, and this results in the following:
Started erase on disk4
Unmounting disk
Creating the partition map
Waiting for partitions to activate
Formatting disk4s1 as MS-DOS (FAT32) with name NONE
Error: -69830: This operation requires an unmounted disk
Here are some other outputs
diskutil list disk4
/dev/disk4 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *16.0 GB disk4
1: Windows_FAT_16 RECOVERY 1.2 GB disk4s1
2: Linux 33.6 MB disk4s5
3: Windows_FAT_32 boot 72.4 MB disk4s6
4: Linux 14.7 GB disk4s7
sudo fdisk /dev/disk4
Disk: /dev/disk4 geometry: 1947/255/63 [31291392 sectors]
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: 0E 128 0 1 - 1023 3 16 [ 8192 - 2362902] DOS FAT-16
2: 05 1023 3 16 - 1023 3 16 [ 2371094 - 28920298] Extended DOS
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: 83 1023 3 16 - 1023 3 16 [ 2375680 - 65534] Linux files*
2: 05 1023 3 16 - 1023 3 16 [ 2441214 - 28850178] Extended DOS
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: 0C 1023 3 16 - 1023 3 16 [ 2441216 - 141312] Win95 FAT32L
2: 05 1023 3 16 - 1023 3 16 [ 2582528 - 28708864] Extended DOS
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: 83 1023 3 16 - 1023 3 16 [ 2588672 - 28702720] Linux files*
2: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
sudo gpt -r show /dev/disk4
start size index contents
0 1 MBR
1 8191
8192 2362902 1 MBR part 14
2371094 28920298 2 MBR part 5
$ echo "auto dos\nq\ny" | sudo fdisk -e /dev/disk4
Password:
fdisk: could not open MBR file /usr/standalone/i386/boot0: No such file or directory
Enter 'help' for information
fdisk: 1> fdisk:*1> Writing current MBR to disk.
Device could not be accessed exclusively.
A reboot will be needed for changes to take effect. OK? [n] %
------------------------------------------------------------
$ sudo newfs_msdos -F 32 -v MYSDCARD /dev/disk4s1
newfs_msdos: /dev/disk4s1: Resource busy
------------------------------------------------------------
$ diskutil mount disk4s1
Volume RECOVERY on disk4s1 mounted
$ echo "erase\nq\ny" | sudo fdisk -e /dev/disk4
fdisk: could not open MBR file /usr/standalone/i386/boot0: No such file or directory
Enter 'help' for information
fdisk: 1> fdisk:*1> Writing current MBR to disk.
Device could not be accessed exclusively.
A reboot will be needed for changes to take effect. OK? [n] %
Best Answer
Big Sur (macOS 11.1) seams to have problems dealing the
FDisk_partition_scheme
when theExtended DOS
partition is not the 4th entry in the Master Boot Record (MBR) partition table.The OP tried to use various forms of the
diskutil
command to erase the current partitioning. Also, the OP tried using thedd
command to overwrite the MBR table with zeros. Bothdiskutil
anddd
commands require exclusive access todisk4
before making changes. Evidently, this fails to happen.The
fdisk
command will work with shared access. One possible solution would be to use the following to erase all the partitions.Another possible solution would be to use the following to create a single FAT32 formatted volume.