Most options require root access to the device
diskutil <verb> <options>
list partitions information info eject mountDisk/unmountDisk all mountable volumes mount/umount verifyVolume repairVolume eraseVolume verifyPermissions repairPermissions repairOS9Permissions rename reformat resizeVolume partitionDisk removing all volumes eraseDisk eraseOptical zeroDisk randomDisk (writing random data to the media secureErase enableJournal/disableJournal HFS+ createRAID enableRAID Convert a disk to a degraded RAID mirror set convertRAID Convert a RAID 1.x pre-Tiger to a RAID 2.x Tiger updateRAID Update seiings addToRAID Add a spare or member disk removeFromRAID Remove a spare or member disk checkRAID repairMirror Repair damaged set destroyRAID diskutil verb with no options will provide help on that verb diskutil resizeVolume disk1s2 limits Volume format does not support resizing
diskutil resizeVolume [Mount Point|Disk Identifier|Device Node] size
part1Format part1Name part1Size part2Format part2Name part2Size ...
Only supported on GPT media with a Journaled HFS+ filesystem.
When decreasing size, optionally supply a list of new partitions to create.
Example:
A size of
Valid filesystems:
See the DEVICES section below for the various forms that the device specification may take for this and all of the other
diskutil verbs.
The top-to-boiom appearance of partitions in diskutil list always indicates the on-disk ordering. BSD disk identifiers
may, in certain circumstances, not appear in slice-numerical order when viewed this way. This is normal and is likely the
result of a recent partition map editing operation in which volumes were kept mounted.
This seiing for a particular volume is persistent across ejects and injects of that volume as seen by the current OS, even
across reboots of that OS, because of the entries in this OS's Volume Database. Note thus that the seiing is not kept on
the target disk, nor is it in-memory.
For some locations of devices (e.g. internal hard disks), consideration of ownership seiings on FSOs is the default. For
others (e.g. plug-in USB disks), it is not.
When ownership is disabled, Owner and Group ID seiings on FSOs appear to the user and programs as the current user and
group instead of their actual on-disk seiings, in order to make it easy to use a plug-in disk of which the user has physical possession.
When ownership is enabled, the Owner and Group ID seiings that exist on the disk are taken into account for determining
access, and exact seiings are written to the disk as FSOs are created. A common reason for having to enable ownership is
when a disk is to contain FSOs whose User and Group ID seiings, and thus permissions behavior overall, is critically important, such as when the plug-in disk contains system files to be changed or added to.
See vsdbutil . Running as root is required.
A size of limits will print the range of valid values for the current filesystem.
When decreasing the size, new partitions may optionally be created to fill the newly-freed space. To do this, specify the
numberOfPartitions, format, name, and size parameters in the same manner as the triplet description for the partitionDisk
verb.
Resizing a volume that is currently set as the computer's startup disk will invalidate that seiing; use the Startup Disk
System Preferences panel or bless (8) to reset the resized volume as the startup disk.
Device refers to a volume; the volume's file system must be journaled HFS+. Valid sizes are a number followed by a capital
leier multiplier or percent sign suffix as described in the sizes section at the end of this page (e.g. 1.5T, 128M, 50%).
Ownership of the affected disk is required.
The forms diskUsQ and diskUsS appear the same and must be distinguished by context.
Erase a disk Erase a volume Partition a disk with three partitions Partition a disk with the APM partitioning scheme Partition a disk with the GPT partitioning scheme Resize a volume and create a volume after it, using all remaining space Resize a volume and leave all remaining space as unused Merge two partitions into a new partition Split a partition into three new ones Create a RAID Destroy a RAID Repair a damaged RAID Convert volume into RAID volume
Ownership of the affected disk is required.
Valid partition sizes are in the format of
Valid sizes are B(ytes), K(ilobytes), M(egabytes), G(igabytes), T(erabytes)
10G (10 gigabytes), 4.23T (4.23 terabytes), 5M
(5 megabytes)
limits displays the range of valid values for the current filesystem.
Example: diskutil resizeVolume disk1s3 10G JHFS+ HDX1 5G MS-DOS HDX2 5G
HFS, HFS+
Case-sensitive HFS+
Journaled HFS+
Case-sensitive Journaled HFS+
MS-DOS, MS-DOS FAT12, MS-DOS FAT16, MS-DOS FAT32
UFS, Linux, Swap
diskutil manipulates the volume-level structure of local disks. It provides information about, and allows the administration of, the
partitioning scheme of disks, optical discs, and AppleRAID sets.
list [-plist | disk]
sudo diskutil list
/dev/disk0
#: type name size identifier
0: Apple_partition_scheme *55.9 GB disk0
1: Apple_partition_map 31.5 KB disk0s1
2: Apple_HFS MacHD 14.2 GB disk0s3
3: Apple_HFS DATA 3.8 GB disk0s5
4: Apple_HFS PHOTOS 3.8 GB disk0s7
5: Apple_UNIX_SVR2 120.0 MB disk0s8
6: Apple_HFS BACKUPS 23.3 GB disk0s10
7: Apple_Boot 8.5 MB disk0s13
8: Apple_UNIX_SVR2 1015.5 MB disk0s14
/dev/disk1 (SD card from camera)
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *2.0 GB disk1
1: DOS_FAT_16 DGERMAN181 2.0 GB disk1s1
/dev/disk2 (unmounted! xxx.dmg ?)
#: TYPE NAME SIZE IDENTIFIER
0: Apple_partition_scheme *1.5 MB disk2
1: Apple_partition_map 32.3 KB disk2s1
2: Apple_HFS Google Chrome 12.0.7... 1.5 MB disk2s2
sudo diskutil list -plist
<?xml version="1.0" encoding="UTF-8"?
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"
<plist version="1.0"
<dict
<key>AllDisks</key
<array
<string>disk0</string
<string>disk0s1</string
<string>disk0s2</string
<string>disk0s3</string
<string>disk0s4</string
<string>disk0s5</string
<string>disk1</string
<string>disk1s1</string
<string>disk2</string
<string>disk2s1</string
<string>disk2s2</string
</array
<key>VolumesFromDisks</key>
<array>
<string>Macintosh HD</string>
<string>DATA</string>
<string>Photos</string>
<string>HDIMAGES</string>
<string>DGERMAN181</string>
<string>Google Chrome 12.0.742.112-12.0.742.122 Update</string>
</array>
<key>WholeDisks</key>
<array>
<string>disk0</string>
<string>disk1</string>
<string>disk2</string>
</array>
</dict>
</plist>
info MountPoint |
DiskIdentifier |
DeviceNode |
UUID
† diskutil info /volumes/data
Device Identifier: disk0s3 Device Node: /dev/disk0s3
Part of Whole: disk0
Device / Media Name: Untitled
Volume Name: DATA Escaped with Unicode: DATA
Mounted: Yes
Mount Point: /Volumes/DATA Escaped with Unicode: /Volumes/DATA
File System Personality: Journaled HFS+ Type (Bundle): hfs
Name (User Visible): Mac OS Extended (Journaled)
Journal: Journal size 8192 KB at offset 0xbd000
Owners: Enabled
Partition Type: Apple_HFS OS Can Be Installed: Yes
Media Type: Generic Protocol: SATA
SMART Status: Verified
Volume UUID: 87D2C53E-7563-3207-B019-528AC90F0B7E
Total Size: 32.0 GB (32000000000 Bytes) (exactly 62500000 Blocks)
Volume Free Space: 13.7 GB (13705142272 Bytes) (exactly 26767856 Blocks)
Device Block Size: 512 Bytes
Read-Only Media: No Read-Only Volume: No Ejectable: No
Whole: No Internal: Yes Solid State: No
listFilesystems [-plist]
Show the file system personalities available for formaiing in diskutil when using the erasing and partitioning verbs. This
is a subset of the complete set of personalities exported by the various filesystem bundles that may be installed in the
system. Also shown are some shortcut aliases for common personalities. See the FORMAT section below for more details. If
-plist is specified, then a property list instead of the normal user-readable output will be displayed.
unmount
umount [force] disk
Unmount a single volume.
force will force-unmount the volume (less kind to any open files; see also umount (8)).
unmountDisk
Unmount an entire disk (all volumes).
eject device
Media will become offline for the purposes of being a data store for file systems or being a member of constructs such as software RAID or direct data.
Removable media will become eligible for safe manual removal;
automatically-removable media will begin its physical eject sequence.
mount [readOnly] [-mountPoint path] disk
Mount a single volume. readOnly
Even the super-user may not write to it; this is the same as the
rdonly option to mount (8).
-mountPoint path rather than the standard path of /Volumes/VolumeName, will be used as the view into the volume file content; a directory at that path must already exist.
mountDisk disk Mount all mountable volumes).
rename
renameVolume disk name
Volume names are subject to file system-specific alphabet and length restrictions.
enableJournal disk
on an HFS+ volume. This works whether or not the volume is currently mounted (the volume is temporarily
mounted if necessary). Ownership of the affected disk is required.
disableJournal [force] disk
Disable journaling on an HFS+ volume. This normally works whether or not the volume is currently mounted (the volume is
temporarily mounted if necessary). If the force option is specified, then journaling is disabled directly on disk; in this
case, the volume must not be mounted. Ownership of the affected disk is required.
moveJournal external|internal
[journalDevice] disk
external causes the creation of a 512MB Apple_Journal partition out of journalDevice and an HFS+ partition will be created out of the
remaining space if available; journalDevice must be a partition, not a whole-disk. The journal for device will then be moved
externally onto the newly created Apple_Journal partition.
internal will move the journal for device back locally.
enableOwnership device
The on-root-disk Volume Database at /var/db/volinfo .database is manipulated such that the
User and Group ID seiings of files, directories, and links (file system objects, or "FSOs") on the target volume are taken
into account.
disableOwnership device
See enableOwnership above. Running as root is required.
verifyVolume device
Verify the data structure of a volume (e.g. fsck). Ownership of the affected disk is required.
repairVolume device
Repair the data structure of a volume (e.g. fsck). Ownership of the affected disk is required.
sudo diskutil repairVolume /Volumes/DGERMAN_2GB
Password:
Started file system repair on disk2s1 DGERMAN_2GB
Checking file system
** /dev/disk2s1
** Phase 1 - Preparing FAT
** Phase 2 - Checking Directories
** Phase 3 - Checking for Orphan Clusters
106 files, 1783744 KiB free (55742 clusters)
Volume repair complete
Updating boot support partitions for the volume as required
Finished file system repair on disk2s1 DGERMAN_2GB
verifyPermissions [-plist] device
Verify the permissions of a Mac OS X boot volume. The data that guides the permissions verification is wriien during the
installation process.
repairPermissions [-plist] device
Repair the permissions of a Mac OS X boot volume. The data that guides the permissions repair is wriien during the installation process. Ownership of the affected disk is required.
eraseDisk format name [[APM]Format | [MBR]Format | [GPT]Format] device
Erase an existing disk, removing all volumes and writing out a new partitioning scheme containing one new empty filesystem
volume. If the partitioning scheme is not specified, then an appropriate one for the current machine is chosen. Format is
discussed below in the section for the partitionDisk verb. Ownership of the affected disk is required.
eraseVolume format name device
Erase an existing volume or write out a new empty filesystem if there was none. Format is discussed below in the section
for the partitionDisk verb. Ownership of the affected disk is required.
eraseOptical [quick] device
Erase optical media (CD/RW, DVD/RW, etc.). Quick specifies whether the disc recording system software should do a full
erase or a quick erase. Ownership of the affected disk is required.
zeroDisk device
Erase a device, writing zeros to the media. The device can be a whole-disk or a partition. In either case, in order to be
useful again, zero'd whole-disks will need to be partitioned, or zero'd partitions will need to be erased (newfs'd), e.g. by
using the partitionDisk or eraseDisk verbs. If you desire a more sophisticated erase algorithm or if you need to erase only
free space not in use for files, use the secureErase verb. Ownership of the affected disk is required.
randomDisk [times] device
Erase a whole disk, writing random data to the media. Times is the optional (defaults to 1) number of times to write random
information. The device can be a whole-disk or a partition. In either case, in order to be useful again, randomized wholedisks will need to be partitioned, or randomized partitions will need to be erased (newfs'd), e.g. by using the
partitionDisk or eraseDisk verbs. If you desire a more sophisticated erase algorithm or if you need to erase only free
space not in use for files, use the secureErase verb. Ownership of the affected disk is required.
secureErase [freespace] level device
Erase, using a secure method, either a whole-disk (including any and all partitions), or, only the free space (not in use
for files) on a currently-mounted volume. Erasing a whole-disk will leave it useless until it is partitioned again. Erasing freespace on a volume will leave it exactly as it was from an end-user perspective, with the exception that it will not
be possible to recover deleted files or data using utility software. If you need to erase all contents of a partition but
not its hosting whole-disk, use the zeroDisk or randomDisk verbs. Ownership of the affected disk is required.
Level should be one of the following:
partitionDisk device [numberOfPartitions] [[APM]Format | [MBR]Format | [GPT]Format] [part1Format part1Name part1Size part2Format
part2Name part2Size part3Format part3Name part3Size ...]
(re)Partition a disk, removing all volumes. All volumes on this disk will be destroyed. The device parameter specifies
which whole disk is to be partitioned. The optional numberOfPartitions parameter specifies the number of partitions to create; if given then the number of parameter triplets (see below) is expected to match; else, the number of triplets alone
given will determine the number of partitions created.
The optional partitioning scheme parameter forces a particular partitioning scheme; if not specified, a suitable default is
chosen. They are:
resizeVolume device size [numberOfPartitions] [part1Format part1Name part1Size part2Format part2Name part2Size part3Format part3Name
part3Size ...]
Non-destructively resize a volume. You may increase or decrease its size.
splitPartition device [numberOfPartitions] [part1Format part1Name part1Size part2Format part2Name part2Size part3Format part3Name
part3Size ...]
Destructively split a volume into multiple partitions. You must supply a list of new partitions to create in the space of
the old partition; specify these with the numberOfPartitions, format, name, and size parameters in the same manner as the
triplet description for the partitionDisk verb.
Device refers to a volume. Ownership of the affected disk is required.
mergePartitions [force] format name fromDevice toDevice
Merge two or more partitions on a disk. All data on merged partitions other than the first will be lost. The first will be
erased if it doesn't have a resizable type (e.g. JHFS+) or if the force argument is given. Format and name apply only when
the first partition is being erased. Merged partitions are required to be ordered sequentially on disk (see diskutil list
for the actual on-disk ordering). Ownership of the affected disk is required.
appleRAID raidVerb [...]
AppleRAID verbs can be used to create, manipulate and destroy AppleRAID volumes (Software RAID). AppleRAID supports three
basic types of RAID sets:
list [UUID]
Display AppleRAID volumes with current status and associated member disks. If UUID is specified, only list that
RAID. diskutil listRAID is a deprecated synonym for diskutil appleRAID list.
create mirror|stripe|concat setName format devices ...
Create a new RAID set consisting of multiple disks and/or RAID sets. setName is used for both the name of the
created RAID volume and the RAID set itself (as displayed in list). e.g. 'diskutil createRAID stripe MyArray
JHFS+ disk1 disk2 disk3 disk4'. Ownership of the affected disks is required. diskutil createRAID is a deprecated synonym for diskutil appleRAID create.
delete raidVolume
Destroy an existing RAID set. If the RAID set is a mirror with a resizable filesystem, delete will aiempt to
convert each of the member partitions back into a non-RAID volume while retaining the contained filesystem. For
concatenated RAID sets with a resizable filesystem, delete will aiempt to shrink the filesystem to fit on the
first member partition and convert that to a non-RAID volume. Ownership of the affected disks is required.
diskutil destroyRAID is a deprecated synonym for diskutil appleRAID delete.
repairMirror raidVolume newDevice
Repair a degraded mirror by replacing a broken or missing member. Broken devices in the mirrored set can also be
rebuilt by specifying newDevice. When replacing members of a mirrored set, the new disk must be the same size or
larger than the existing disks in the RAID set. Ownership of the affected disk is required. diskutil
repairMirror is a deprecated synonym for diskutil appleRAID repairMirror.
add type newDevice raidVolume
Add a new member or hot spare to an existing RAID set. Type can be either member or spare. New disks are added
live, the RAID volume does not need to be unmounted. Mirrored volumes support adding both members and hot
spares, concatenated volumes only support adding members. When adding to a mirrored RAID set, the new disk must
be the same size or larger than the existing disks in the RAID set. Adding a hot spare to a mirror will enable
autorebuilding for that mirror. Adding a new member to a concatenated RAID set appends the member and expands
the RAID volume. Ownership of the affected disk is required. diskutil addToRAID is a deprecated synonym for
diskutil appleRAID add.
remove oldDevice raidVolume
Remove a member or spare from an existing RAID set. Old disks are removed live, the RAID volume does not need to
be unmounted. For missing devices, oldDevice must be the device's UUID. Online mirror members with a resizable
filesystem will be converted to non-RAID volumes, spare and offline members will be marked free. For concatenated RAID sets, only the last member can be removed. For resizable filesystems remove will first aiempt to
shrink the concatenated RAID set so that the filesystem fits on the remaining disks. Ownership of the affected
disk is required. diskutil removeFromRAID is a deprecated synonym for diskutil appleRAID remove.
enable mirror|concat device
Convert a non-RAID disk partition containing a resizable filesystem (like JHFS+) into an unpaired mirror or single disk concatenated RAID set. Disks that were originally partitioned on Mac OS X 10.2 Jaguar or earlier or
were partitioned to be Mac OS 9 compatible may not be resizable. Ownership of the affected disk is required.
diskutil enableRAID is a deprecated synonym for diskutil appleRAID enable.
update key value raidVolume
Update the key value parameters of an existing RAID set. Valid keys are:
disk reference
disk*, e.g. disk1s9.
DISK IDENTIFIER
Device unit, session on that device, or a partition (slice) upon that session.
Form : diskU, diskUsS, diskUsQ, or diskUsQsS, where U, S, and Q are decimal integers
Some units (e.g. floppy disks, RAID sets) contain filesystem data upon their "whole" device instead of containing a partitioning scheme
with partitions.
For non-optical media, this two-part form identifies a slice upon which (filesystem) data is stored.
For optical media, it identifies a session upon which a partitioning scheme (with its slices with filesystems) is stored.
SIZES
FLoating point number followed by:
When specifying partition triplets, the following relative forms may also be used:
Examples: 10G (10 gigabytes), 4.23T (4.23 terabytes), 5M (5 megabytes), 25.4% (25.4 percent of whole disk size).
FORMAT
The format parameter for the erasing and partitioning verbs is the filesystem personality name. You can determine this name by looking
in a filesystem bundle's /System/Library/Filesystems/EXAMPLES
diskutil eraseDisk UFS UntitledUFS disk3
diskutil eraseVolume HFS+ UntitledHFS /Volumes/SomeDisk
diskutil partitionDisk disk3 3 HFS+ Untitled 10G UFS UntitledUFS 10G MS-DOS DOS 10G
diskutil partitionDisk disk3 APM HFS+ vol1 25% Journaled HFS+ vol2 25% Journaled HFS+ vol3 50% Free Space volX 0%
diskutil partitionDisk disk3 GPT HFS+ vol1 25% MS-DOS vol2 25% HFS+ vol3 50% Free Space volX 0%
diskutil resizeVolume /Volumes/SomeDisk 50g MS-DOS DOS 0b
diskutil resizeVolume /Volumes/SomeDisk 12g
diskutil mergePartitions JHFS+ not disk1s3 disk1s5
diskutil splitPartition /Volumes/SomeDisk JHFS+ vol1 12g MS-DOS vol2 8g JHFS+ vol3 0b
diskutil createRAID mirror MirroredVolume JHFS+ disk1 disk2
diskutil destroyRAID /Volumes/MirroredVolume
diskutil repairMirror /Volumes/MirroredVolume disk3
diskutil enableRAID mirror /Volumes/ExistingVolume
SEE ALSO
authopen(1), hdid(8), hdiutil(1), ufs.util(8), msdos.util(8), hfs.util(8), drutil(1), diskarbitrationd(8), mount(8), umount(8),
newfs(8), vsdbutil(8), fsck(8)
msdos.util -- DOS/Windows (FAT) file system utility
msdos.util [-m mountflag1 mountflag2 mountflag3 mountflag4] device node
msdos.util [-p mountflag1 mountflag2 mountflag3 mountflag4] device
msdos.util [-u] device
msdos.util [-n] device name
The msdos.util command supports the mounting, probing, and unmounting of FAT file systems.
-m mountflag1 mountflag2 mountflag3 mountflag4 mount
-n set name
-p mountflag1 mountflag2 mountflag3 mountflag4 probe for mounting
-u unmount
mountflags :
o removable or fixed
o readonly or writeable
o suid or nosuid
o dev or nodev
fsck_msdos
fsck_msdos -- DOS/Windows (FAT) file system consistency check
fsck_msdos -q special ...
fsck_msdos -p [-f] special ...
fsck_msdos [-fny] special ...
verifies and repairs FAT file systems (more commonly known as DOS file systems).
-p normally started by fsck(8) run
from /etc/rc.boot during automatic reboot, when a FAT file system is detected. When preening file sys-
tems, fsck_msdos will fix common inconsistencies non-interactively. If more serious problems are
found, fsck_msdos does not try to fix them, indicates that it was not successful, and exits.
-q Causes fsck_msdos to quickly check whether the volume was unmounted cleanly. If the vol-
ume was unmounted cleanly, then the exit status is 0. If the volume was not unmounted
cleanly, then the exit status will be non-zero. In either case, a message is printed to
standard output describing whether the volume was clean or dirty.
-f ignored
-n Causes fsck_msdos to assume no as the answer to all operator questions, except ``CONTINUE?''.
-p Preen the specified file systems.
-y Causes fsck_msdos to assume yes as the answer to all operator questions.
HISTORY
The eraseDisk and partitionDisk verbs had an option to add Mac OS 9 drivers (in partitions designated for that purpose); there was also
a repairOS9Permissions verb. These have been removed.
Starting with Mac OS X 10.6, the input and output notation of disk and partition sizes use power-of-10 suffixes. In the past this has
been power-of-2, regardless of the suffix (e.g. G, Gi, GiB) used for display or accepted as input.