Home OS X
OS X Syntax

diskutil

Disk utilities - Format, Verify, Repair (local disks.)

SYNTAX
      diskutil verb [options]

VERBS
Each verb is listed with its description and individual arguments.

     list [device]
		List the partitions of a disk or all disks.  If no device is
		listed, than all partitions on all disks will be displayed.

     info | information device
		Get information on a disk or volume.

     unmount	[force] device
		Unmount a single volume.   Force will force unmount the vol-
		ume.

     unmountDisk [force] device
		Unmount an entire disk (all volumes).  Force will force
		unmount the volumes.

     eject device
		Eject a disk.

     mount device
		Mount a single volume.

     mountDisk device
		Mount an entire disk (all mountable volumes).

     rename name device
		Rename a volume.

     enableJournal device
		Enable HFS+ journaling on a mounted HFS+ volume.  Ownership of
		the affected disk is required.

     disableJournal device
		Disable HFS+ journaling on a mounted HFS+ volume.  Ownership
		of the affected disk is required.

     verifyDisk device
		Verify the disk structure of a volume.	Ownership of the
		affected disk is required.

     repairDisk device
		Repair the structure of a volume.  Ownership of the affected
		disk is required.

     verifyPermissions device
		Verify the permissions of a Mac OS X boot volume.

     repairPermissions device
		Repair the permissions of a Mac OS X boot volume.  Root per-
		missions are required.

     repairOS9Permissions
		Repair the permissions of the user selected Classic System and
		Applications folder.

     eraseDisk format name [OS9Drivers] device
		Erase an existing disk, removing all volumes.  Format dis-
		cussed below.  Ownership of the affected disk is required.

     eraseVolume format name device
		Erase an existing volume.  Format discussed below.  Ownership
		of the affected disk is required.

     eraseOptical [quick] device
		Erase an optical media (CD/RW, DVD/RW, etc.).  Quick specifies
		whether the disc recording stack should do a full erase or a
		quick erase.  Ownership of the affected disk is required.

     zeroDisk device
		Erase a disk, writing zeros to the media.  Ownership of the
		affected disk is required.

     randomDisk [times] device
		Erase a disk, writing random data to the media.	 Times is num-
		ber of times to write random information.  Ownership of the
		affected disk is required.

     partitionDisk device numberOfPartitions [OS9Drivers] [MBRFormat]
		<part1format part1name part1size> <part2format part2name
		part2size> <part3format part3name part3size> ...
		(re)Partition a disk, removing all volumes.  All volumes on
		this disk will be destroyed.  Format is the specific filesys-
		tem name you want to erase it as. (HFS+, etc.)	MBRFormat
		specifies that the partition map should be written in DOS com-
		patible format.	 (OS9Drivers will be ignored in this case)
		Valid sizes are B(ytes), K(ilobytes), M(egabytes), G(iga-
		bytes), T(erabytes) Example: 10G (10 gigabytes), 4.23T (4.23
		terabytes), 5M (5 megabytes) You cannot partition the boot
		disk.	Ownership of the affected disk is required.

     createRAID mirror|stripe setName format device device ...
		Create a RAID set on multiple disks.  Ownership of the
		affected disks is required.

     destroyRAID device
		Destroy an existing RAID set.  Ownership of the affected disks
		is required.

     checkRAID device
		Print out the list of available RAID sets.

     enableRAID mirror device
		Convert single filesystem disk into a unpaired mirror RAID
		set.  Ownership of the affected disks is required.

     repairMirror device sliceNumber fromDisk toDisk
		Repair a failed mirror.	 Supply the slice number to replace
		(from the checkRAID information).  Supply the valid slice disk
		identifier as the second to last parameter.  Supply the new
		disk as the last parameter of the request. fromDisk and toDisk
		are only Device Nodes or Disk Identifiers.  Ownership of the
		affected disk is required.

FORMAT
     The format parameter of erase and partitioning (and RAID creation) is the
     filesystems name.	You can determine this name by looking in the /Sys-
     tem/Library/Filesystems/.fs/Contents/Info.plist.

     Some examples include HFS+, HFS, JournaledHFS+, UFS, MS-DOS, etc.

EXAMPLES

     Erase a disk
     diskutil eraseDisk UFS UntitledUFS disk3

     Erase a volume
     diskutil eraseVolume HFS+ UntitledHFS /Volumes/SomeDisk

     Partition a disk
     diskutil partitionDisk disk3 3 HFS+ Untitled 10G UFS UntitledUFS 10G MS-
     DOS DOS 10G

     Create a RAID
     diskutil createRAID mirror MirrorDisk HFS+ disk disk2

     Destroy a RAID
     diskutil destroyRAID /dev/disk3

     Repair a damaged RAID
     diskutil repairMirror disk3 2 disk1 disk2

DEVICES

     A device parameter to any of the above commands (except where explicitly
     defined otherwise) is any of the following
     The device node entry.  Any entry of the form of /dev/disk*.  ex.
     /dev/disk2
     The disk identifier.  Any entry of the form of disk*.  ex.	 disk1s9
     The volume mount point.  Any entry of the form of /Volumes/Mountpoint.
     ex.  /Volumes/Untitled

"What you want, what you're hanging around in the world waiting for, is for something to occur to you" - Robert Frost

Related commands:

authopen(1)
bless - Set volume bootability and startup disk options.
disktool(8)
drutil(8)
diskarbitrationd(8)
hdid(8)
hdiutil(1)
hfs.util(8)
mount - Mount a file system
msdos.util(8)
ufs.util(8)

Equivalent BASH command:

diskutil - Modify, verify and repair local disks.



Back to the Top

Simon Sheppard
SS64.com