Tuesday, June 24, 2014

Formatting SD card as FAT16 under Mac OS X

I recently purchased a Columbus V990 GPS logger so that I could geo tag my photos. The V990 supports 4GB SD cards. Interestingly, it can read SDHC cards, which would seems to imply that it should be able to support up to 32GB. After digging a bit deeper into the specifications, the limiting factor is due to the V990 supporting only FAT16 file system formats.

The Disk Utility GUI in Mac OS X cannot format SD cards with FAT16. Only FAT32 appears to be supported. In order to format a card as FAT16, you will need to use the command line version of Disk Utility, diskutil, and the BSD command line tool newfs_msdos.

The first step is to get the SD card mounted, which usually involves inserting it in your card reader. Once this is done, you will need to find out the device name that is assigned to card. So run the following on the command line:

bash-3.2$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            999.3 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk3
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *8.0 GB     disk3

   1:                 DOS_FAT_32 GPS_LOGS                8.0 GB     disk3s1

In my case, the SD card is at /dev/disk3. Now we just need unmount the device:

bash-3.2$ diskutil unmountDisk /dev/disk3
Unmount of all volumes on disk3 was successful

The next step is to run newfs_msdos and indicate that we want to create a FAT16 filesystem:

bash-3.2$ sudo newfs_msdos -F 16 /dev/disk3
newfs_msdos: warning: /dev/disk3 is not a character device
512 bytes per physical sector
newfs_msdos: warning: sectors/FAT limits sectors to 4194721, clusters to 65534
newfs_msdos: warning: FAT type limits file system to 4194144 sectors
/dev/disk3: 4193536 sectors in 65524 FAT16 clusters (32768 bytes/cluster)

bps=512 spc=64 res=1 nft=2 rde=512 mid=0xf0 spf=256 spt=32 hds=255 hid=0 drv=0x00 bsec=4194144

After remounting the SD card, you will notice that the capacity is only 2GB, a bit short of what the V990 is supposed to support. In order to increase the capacity to 4GB, we need to increase the number sectors per cluster to 128: 

bash-3.2$ sudo newfs_msdos -F 16 -c 128 -e 1024 /dev/disk3
newfs_msdos: warning: /dev/disk3 is not a character device
512 bytes per physical sector
newfs_msdos: warning: sectors/FAT limits sectors to 8388929, clusters to 65534
newfs_msdos: warning: FAT type limits file system to 8387776 sectors
/dev/disk3: 8387072 sectors in 65524 FAT16 clusters (65536 bytes/cluster)
bps=512 spc=128 res=1 nft=2 rde=1024 mid=0xf0 spf=256 spt=32 hds=255 hid=0 drv=0x00 bsec=8387776

This gives us a 4.29GB FAT16 filesystem, with 1024 files per directory, which is useable by the V990.

No comments:

Post a Comment