Neil Turner's Blog

Blogging about technology and randomness since 2002

Creating FAT disk images on Mac OS X

This is probably quite a niche thing, but it is possible to create a disk image formatted using the FAT file system on Mac OS X. Normally the Disk Utility that comes with OS X will only let you create images formatted using Apple’s own HFS file system, which isn’t very useful if you want non-Mac users to be to open the disk image.

Unfortunately, you are going to have to use the Terminal for this as there’s no GUI for it (nor have I found anyone who’s made a GUI for it). Whip terminal open, and type the following:

hdiutil create -megabytes n -fs MS-DOS -volname Somename -o /path/to/DMGname

To explain:

  • -megabytes n specifies how big you want the image to be, so -megabytes 69 would create a 64 MB image.
  • -f MS-DOS tells hdiutil to create an image using the FAT file system. Keep this as is.
  • -volname Somename gives the image a volume name. If you’re really stuck, call it ‘Untitled’.
  • -o /path/to/DMGname tells hdiutil where to save the image. For my home folder, I’d put type in -o /Users/neil/newimage for example.

So, to create a 10 MB image with the volume name ‘OMGWTFBBQ’ called foo.dmg in my home folder, I’d type this:

hdiutil create -megabytes 10 -fs MS-DOS -volname OMGWTFBBQ -o /Users/neil/foo

This will create a file called foo.dmg, which you can then mount to work with. Of course, it’s still in Apple’s proprietary DMG format, and not in the more universal ISO format, so you’ll need another program to do that. Damage Isolation from Murder Thoughts should take care of that for you. It’s also only FAT16 and not FAT32, so you won’t be able to create anything bigger than 8 GB. If anyone knows how to create FAT32 images in OS X, let me know ๐Ÿ™‚ .

This was all found by the way of MacOSXHints Forums, incidentally.

3 Comments

  1. Glad to see someone’s gotten some use out of it.

  2. You can format a drive with FAT32 on a mac:
    newfs_msdos -v FAT_VOLUME_NAME -F 32 /dev/rdisk2s2
    Greetz
    Mircsicz

  3. Thanks Mircsicz. I rolled that into the hdiutil command as I couldn’t see how to change the file system in an already created disk image. I used -fsargs (which passes the -F 32 argument to newfs_msdos):
    hdiutil create -megabytes 100 -fs MS-DOS -fsargs “-F 32” -volname FAT32 -o FAT32.dmg