macOS Disk Utility – How to Format SD Card with FAT and Custom File Allocation Unit Size

disk-utilitymacossd card

I'm using Maverick (a offline mapping application) on my Android device which has thousands of files in the tile cache with a size of 168 byte. The SD card is formatted with a file allocation unit size of 32 KB. This results for each file in a huge waste of space:

168 Byte (33 KB on the volume)

You can imagine that a 2GB is full even if you want to store 50MB of real data. Is there software I can use on my Mac to change the file allocation unit size during formatting of the device?

Best Answer

Open up a terminal and check out the following command:

NAME
     newfs_msdos -- construct a new MS-DOS (FAT) file system

SYNOPSIS
     newfs_msdos [-N] [-B boot] [-F FAT-type] [-I volid] [-O OEM]
                 [-S sector-size] [-a FAT-size] [-b block-size]
                 [-c cluster-size] [-e dirents] [-f format] [-h heads]
                 [-i info] [-k backup] [-m media] [-n FATs] [-o hidden]
                 [-r reserved] [-s total] [-u track-size] [-v volume-name]
                 special [disktype]

In particular these parameters:

 -S sector-size
         Number of bytes per sector.  Acceptable values are powers of 2 in
         the range 128 through 32768.

 -a FAT-size
         Number of sectors per FAT.

 -b block-size
         File system block size (bytes per cluster).  This should resolve
         to an acceptable number of sectors per cluster (see below).

 -c cluster-size
         Sectors per cluster.  Acceptable values are powers of 2 in the
         range 1 through 128.

You should be able to perform a custom format with the options you need, obviously make sure you test this out thoroughly.