Hdiutil

From OSDev Wiki
Jump to navigation Jump to search

hdiutil is the program supplied by Apple to work with disk images

Support

hdiutil supports the following filesystem types:

  • HFS+
  • HFS+J
  • HFSX
  • HFS
  • MS-DOS
  • UFS

Creating Images

Create a DOS disk image:

hdiutil create -fs ms-dos -sectors 2880 floppy

(2880 sectors = 1.44mb floppy disk image)

If the image already exists, you must pass the -ov option or hdiutil will fail.

To create no apple partition image, use:

-layout NONE

To create an image with an apple partition layout, use:

-layout SPUD

I don't know if images created here are straight binary images that can be plugged into Bochs/VMWare etc...

  • Example of creating and mounting an image:*
hdiutil create -fs MS-DOS -sectors 2880 floppy

This will output floppy.dmg. Note that the MS-DOS argument is case sensitive.

hdid -nomount ./floppy.dmg

This will output the name of the device file created.

mkdir /Volumes/mnt
mount -t msdos /dev/disk2 /Volumes/mnt

Use the name of the device file output in the previous step.

If you chose to not place your executable on a disk directly, you can use hdiutil burn ./floppy.dmg. If you try to use an ordinary burn, the boot image will be corrupt.