1

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] %
5
  • Try diskutil erasedisk fat32 NONE mbr disk3 Jan 17, 2021 at 20:07
  • I tried that but am getting the following error: 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
    – asahi
    Jan 17, 2021 at 20:41
  • You could try first zeroing out the partition tables at the beginning of the drives: sudo dd if=/dev/zero count=33 of=/dev/disk4 Jan 17, 2021 at 20:49
  • You could also try posting the output from the commands diskutil list disk4, sudo fdisk /dev/disk4 and gpt -r show /dev/disk4. These commands do not change anything, but would give a better idea of what is inside. Jan 17, 2021 at 20:56
  • I've tried sudo dd if=/dev/zero count=33 of=/dev/disk4 with the same result. I've also included the outputs from those three commands
    – asahi
    Jan 17, 2021 at 21:47

1 Answer 1

1

Big Sur (macOS 11.1) seams to have problems dealing the FDisk_partition_scheme when the Extended 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 the dd command to overwrite the MBR table with zeros. Both diskutil and dd commands require exclusive access to disk4 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.

echo "erase\nq\ny" | sudo fdisk -e /dev/disk4

Another possible solution would be to use the following to create a single FAT32 formatted volume.

echo "auto dos\nq\ny" | sudo fdisk -e /dev/disk4
sudo newfs_msdos -F 32 -v MYSDCARD /dev/disk4s1
diskutil mount disk4s1

Note: I have observed the mountdisk verb of diskutil command does not always mount all mountable and UI-browsable volumes on the given partition map.

6
  • Thanks for much for the suggestions. I tried running sudo fdisk -e /dev/disk4 and got the result, fdisk: could not open MBR file /usr/standalone/i386/boot0: No such file or directory. FWIW the other SD card had a single partition and I was able to format it with a Raspberry Pi Imager program on my MBA. I also have a windows 10 machine sitting around, so I plan to give that a shot.
    – asahi
    Jan 18, 2021 at 14:39
  • No version of macOS (OS X) has the boot0 file. The message is just a warning and can be ignored. The file is not needed. I should also point out entering the command sudo fdisk -e /dev/disk4 alone will not do anything. You need to enter the entire line posted in my answer. Jan 18, 2021 at 20:37
  • I did try the entire lines as posted, and pasted the outputs above. Based on the output, it sounds like they aren't working because the resource is being shared.
    – asahi
    Jan 19, 2021 at 0:16
  • It looks the same as what I pasted
    – asahi
    Jan 19, 2021 at 0:27
  • From new output posted to your question, I can see the commands are not changing the MBR partition table. @Tetsujin had posted a comment which has now been deleted. I believe the opinion was the card is bad and may need to be replaced. You may want to first try erasing using a machine running Windows. You have now tried everything that I know of that macOS has to offer. Jan 19, 2021 at 0:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .