Have you ever met this problem that a flash memory card or USB flash drive is not showing the full capacity but a wrong size in macOS? I got this problem every time when trying to erase an SD memory card after working with Raspberry Pi. In this article I will show you how to format a flash drive to reclaim full capacity and make it available for saving data again now.
What causes this issue
I noticed that no matter the size of my SD memory card, after writing an image with OS for my Raspberry Pi, macOS can only recognise one partition with about 60 MB. If I try to format it using macOS built-in
Disk Utility app, it will only free the space in that partition. This is not a my SD memory card issue. And it can happen with a flash drive from any manufacturer. This is not a problem with the flash drive at all.
In my case it’s all about the type of previous formatting. To use a flash drive as a boot disk (for example, with the OS for Raspberry Pi), it creates two partitions: the first one with the bootloader and occupies 60 MB, the second one with the OS files is a hidden partition and occupies the rest of the flash drive space. The Disk Utility app does not see this hidden partition and therefore formats only the first partition instead of the two.
How to solve it
To solve this issue, we will use the Terminal app and the tool
diskutil. This tool is built-in in macOS, so we do not need to download or install anything.
Critical! The instructions in the article below are designed to help format a flash drive. This process is data destructive and cannot be undone. Once the process begins, all the data on the flash drive will be lost!
Connect the flash drive which is not showing full capacity to your Mac.
Firstly, in order to avoid data loss, we need to restore and extract data from the flash drive. If we can open the flash drive, we may directly copy and save files from the flash drive to other storage device. If the flash drive is not accessible now, our best choice is to use any professional flash drive recovery software for help.
Execute the following command to identify the mount name of the flash drive following the pattern
/dev/disk0 (internal): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme 251.0 GB disk0 1: EFI EFI 314.6 MB disk0s1 2: Apple_APFS Container disk1 250.7 GB disk0s2 /dev/disk1 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +250.7 GB disk1 Physical Store disk0s2 1: APFS Volume Macintosh HD 125.3 GB disk1s1 2: APFS Volume Preboot 21.9 MB disk1s2 3: APFS Volume Recovery 519.0 MB disk1s3 4: APFS Volume VM 4.3 GB disk1s4 /dev/disk2 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *4.0 GB disk2 1: DOS_FAT_32 DRIVE 58.7 MB disk2s1 2: Linux 4.0 GB disk2s2
Note! The below commands assume this is
disk2, but replace
disk2with the correct disk if it’s something different.
Say the disk name is
/dev/disk2. Now format the flash drive to FAT32 by running the following command (this will erase the entire flash drive):
sudo diskutil eraseDisk FAT32 MYSD MBRFormat /dev/disk2
Warning! Do not forget to replace the
disk2before pressing the key Enter.
Note! Replace “MYSD” with the name that you want to give to your flash drive.
This command will prompt us to enter our computer password. Enter your password and then watch the magic happen…
Note! It’s normal that the password you enter is not displayed. This is how the password is entered on the command line. Just enter your password, and then press the Enter key.
Password: Started erase on disk2 Unmounting disk Creating the partition map Waiting for partitions to activate Formatting disk2s1 as MS-DOS (FAT32) with name MYSD 512 bytes per physical sector /dev/rdisk2s1: 7881656 sectors in 985207 FAT32 clusters (4096 bytes/cluster) bps=512 spc=8 res=32 nft=2 mid=0xf8 spt=32 hds=255 hid=2 drv=0x80 bsec=7897086 bspf=7697 rdcl=2 infs=1 bkbs=6 Mounting disk Finished erase on disk2
Let’s now re-enter the
diskutil list command to verify that the flash drive is showing full capacity (in my case - 4 GB) instead of 58.7MB.
/dev/disk0 (internal): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme 251.0 GB disk0 1: EFI EFI 314.6 MB disk0s1 2: Apple_APFS Container disk1 250.7 GB disk0s2 /dev/disk1 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +250.7 GB disk1 Physical Store disk0s2 1: APFS Volume Macintosh HD 125.3 GB disk1s1 2: APFS Volume Preboot 21.9 MB disk1s2 3: APFS Volume Recovery 519.0 MB disk1s3 4: APFS Volume VM 4.3 GB disk1s4 /dev/disk2 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *4.0 GB disk2 1: DOS_FAT_32 MYSD 4.0 GB disk2s1
That’s it, we’re done. We reclaimed full capacity on flash drive, and make it available for saving data again now. We can leave our flash drive in the FAT32 format or convert it to any other format using the Disk Utility app. So simple isn’t it?
If you are having trouble fixing this problem with the instructions above, but are being able to solve this problem with any another method please describe it in the comment section below. Thanks!
If this article has helped you solve the problem then please leave a comment
Thanks for reading!