User Tools

Site Tools


You are not allowed to perform this action
macosmediamanipulation

Handling physical and virtual media in macOS

Disk image manipulation

Mounting

hdiutil attach Adobe\ Photoshop\ 7\ DE.img

Attach as block device, but don't mount

hdiutil attach -nomount -noverify Downloads/QuickTime_Installer_6.5.1.dmg

Create an image from a folder

hdiutil create -volname $VOLUMENAME -srcfolder $SOURCEFOLDER {-format $IMAGEFORMAT} -fs $FILESYSTEM $FILENAME

Create a Joliet/ISO compatible image from a folder

hdiutil makehybrid -iso -joliet -o image.iso /path/to/source

Create an image from a device

hdiutil create -srcdevice /dev/diskN -format $IMAGEFORMAT ImageFromDevice.dmg == Create an empty raw image (Apple Partition) hdiutil create -volname Snow\ HD -size 20G -type UDIF -layout SPUD -fs HFS+ Snow.img

Show information on an image

hdiutil imageinfo /Users/wolfo/Downloads/QuickTime\ 6.3.1\ for\ OSX\ 10.1.5\ date\ 20040401.dmg

Compact a sparse image

hdiutil compact Address\ Book\ Backup.sparseimage

Filesystems used by hdiutil
UDF Universal Disk Format (UDF)
MS-DOS FAT12 MS-DOS (FAT12)
MS-DOS MS-DOS (FAT)
MS-DOS FAT16 MS-DOS (FAT16)
MS-DOS FAT32 MS-DOS (FAT32)
HFS+ Mac OS Extended
Case-sensitive HFS+ Mac OS Extended (Case-sensitive)
Case-sensitive Journaled HFS+ Mac OS Extended (Case-sensitive, Journaled)
Journaled HFS+ Mac OS Extended (Journaled)
ExFAT ExFAT
Case-sensitive APFS APFS (Case-sensitive)
APFS APFS
Partition layouts used by hdiutil
MBRSPUD Single partition - Master Boot Record Partition Map
SPUD Single partition - Apple Partition Map
UNIVERSAL CD CD/DVD
NONE No partition map
GPTSPUD Single partition - GUID Partition Map
SPCD Single partition - CD/DVD
UNIVERSAL HD Hard disk
ISOCD Single partition - CD/DVD with ISO data
Image formats used by hdiutil
UDRO read-only
UDCO compressed (ADC)
UDZO compressed
UDBZ compressed (bzip2)
ULFO compressed (lzfse)
ULMO compressed (lzma)
UFBI entire device
IPOD iPod image
UDxx UDIF stub
UDSB sparsebundle
UDSP sparse
UDRW read/write
UDTO DVD/CD master
DC42 Disk Copy 4.2
RdWr NDIF read/write
Rdxx NDIF read-only
ROCo NDIF compressed
Rken NDIF compressed (KenCode)

Manipulation of physical media (diskutil)

Erasing/formatting a disk

diskutil eraseDisk FAT32 VolumeName MBR diskN

Securely erasing a volume

diskutil secureErase 4 diskN

0 Single-pass zeros.
1 Single-pass random numbers.
2 US DoD 7-pass secure erase.
3 Gutmann algorithm 35-pass secure erase.
4 US DoE 3-pass secure erase.
Zeroing a disk

diskutil zeroDisk /dev/diskN

Randomising a disk

diskutil randomDisk /dev/diskN

Force unmount volume

diskutil unmountDisk force diskX

Encrypted volumes

Change password for encrypted disk image

hdiutil chpass $FILENAME

Optical media

Burn an image to an optical disc

hdiutil burn /Volumes/Downloads/Mac\ OS\ X\ Jaguar/Mac\ OS\ X\ Install\ Disc\ 1.toast

Erase a rewritable disc

diskutil eraseOptical /dev/disk8

macosmediamanipulation.txt · Last modified: by wolfo

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki