diskutil is the command line version of Disk Utility, the macOS application used to manage hard drives. Just like Disk Utility, you can use the command to format disks, erase drives and more. Once you're familiar with it, you'll find that the command is often more powerful and faster than Disk Utility, with more features to boot.
Getting Acquainted with diskutil
If you simply type diskutil
into the command line and press Enter, you'll receive a list of 'verbs' that diskutil
can operate on.
Just like in the English language, these verbs are things that diskutil
can accomplish. The most basic verb for diskutil
is list
, which you'll enter like so:
UPDATES: Mac App Store customers get the latest version of Mountain for free on our web site. Living seamlessly in the menu bar Mountain allows you to manage volumes with ease. With Mountain you can mount, unmount or eject drives with two easy clicks.
This command will list all the disks attached to your machine. It indicates information like partitions, format and, importantly, mount points. The mount points start with /dev/disk
and are used to specify disk operations in diskutil.
Partitions (called 'volumes' in diskutil
parlance) are specified by their identifier on the right.
- The mount command calls the mount(2) system call to prepare and graft a special device or the remote node (rhost:path) on to the file system tree at the point node. If either special or node are not provided, the appropriate information is taken from the fstab(5) file.
- 4 Fixes to a MacBook Pro That Can't Mount Its Startup Disk. In most cases, mounting is an automatic process that happens as soon as the hard drive is connected to a Mac or MacBook Pro. Then again, drive mounting can be performed manually using the Disk Utility of your machine. It will be discussed further below.
Disk identifiers follow the format disk_s_, where the underscores are replaced with identifying numbers.
Using verbs
We can use the other verbs to get more information about our drives and run specific operations.
The info verb gets more information about a specific disk (disk1, in this case). Use the mount point to specify the target disk to grab information on. You'll see tons of stuff you might care about and a lot of stuff you won't. This is the most information you can get about your disk in one place, and it's helpful when troubleshooting drive problems.
Unmounting and Ejecting with diskutil
The umount
verb unmounts a specified volume. Unmounting is just like ejecting a volume from Finder, but it can be done to internal disks. In this example, I've specified the volume I want to unmount with the disk identifier. You can also specify the volume using the partition name. Unmounted disks become inaccessible via Finder, but they can still be seen via diskutil list
and manipulated with other diskutil
commands. Also, note the command is umount
, with no 'n'.
The unmountDisk
verb is similar to umount
, but it unmounts an entire disk instead of one volume. Disks are specified with their mount point, as seen above. You can't unmount your boot disk or volume, and you'll get an error if you try to unmount a disk or drive that's currently in use.
The eject
verb is a lot like unmounting a drive, but only for removable disks. Removable disks are things like USB hard drives and flash drives. If it connects through an interface on the outside of your computer, it qualifies as a removable drive. Once a drive is ejected, it won't appear in Finder or diskutil list
until it's physically unplugged and plugged in to its interface again.
The mount
verb is the inverse of the umount verb. It mounts volumes on internal disks manually. Only unmounted volumes can be mounted, obviously. To mount all volumes on a disk, use diskutil mountDisk disk1
, for example.
Mount Me For Macbook
Fixing Problems with diskutil
The verifyVolume
verb will run a verification pass on a specific volume. Verification involves checking the contents of the disk against the expected values. If any mismatches are found, the disk will be identified as in need of repair.
If it turns out that your volume needs to be repaired after you've verified it, you can run the repairVolume verb. This will run a repair pass on the volume and attempt to fix any problems found in the verification process.
Format and Erase Drives with diskutil
The eraseDisk verb handles reformatting disks, which erases all data and volumes on a single disk. The verb takes as inputs the format, new disk name and disk identifier, in that order. This example will erase disk2 and reformat it as journaled HFS+. The new disk will have one volume named
The reformat
verb will erase a single volume on the disk while keeping the same name and format. It rewrites the same file system that the volume started with, resetting the volume to a blank state.
Partition Drives with diskutil
The partitionDisk verb runs an command-line version of Disk Utility, allowing you to create multiple partitions on a single disk. It's a little complicated, but it follows this format for it's arguments:
Virus apple macbook. diskutil partitionDisk MountPoint[numberOfPartitions] [APM|MBR|GPT] [part1Format part1Name part1Size part2Format part2Name part2Sizepart3Format part3Name part3Size .]
Partition sizes can be specified in gigabytes with the G suffix (2 G) or terabytes with the T suffix (2 T). My favorite way to specify partition sizes, however, is with percentages (25%, for example). The size of the final partition can be specified with 'R' to indicate that it should take up the remainder of the disk.
For example, the following command will create three partitions:
They'll be formatted with JHFS+, APFS and ExFAT, and named Volume1, Volume2 and Volume3 respectively. Volume1 and Volume2 will each take up 25 percent of the disk, and Volume3 will occupy the remainder. It will also use the GUID Partition Table (GPT) which is one of the more flexible partition table options.
You can see the results of the operation at the end of the Terminal window to determine everything went okay. Using partionDisk
isn't the easiest way to partition a disk, but if Disk Utility is complaining, its a good alternative.
You might also like:
Terminal Tips: Making Terminal More User-Friendly
Getting Started with Terminal: Using Grep to Search Files
Mount Me For Mac Catalina
Getting Started with Terminal: Must-Know macOS Terminal Commands
Disk Utility User Guide
You can use Disk Utility to create a disk image, which is a file that contains other files and folders.
Note: You can burn information to a CD or DVD using the Burn command in the Finder. See Burn CDs and DVDs.
Create a blank disk image for storage
You can create an empty disk image, add data to it, then use it to create disks, CDs or DVDs.
Mount Me For Mac Os
In the Disk Utility app on your Mac, choose File > New Image > Blank Image.
Enter a filename for the disk image, add tags if necessary, then choose where to save it.
This is the name that appears in the Finder, where you save the disk image file before opening it.
In the Name field, enter the name for the disk image.
This is the name that appears on your desktop and in the Finder sidebar, after you open the disk image.
In the Size field, enter a size for the disk image.
Click the Format pop-up menu, then choose the format for the disk:
If the disk image will be used with a Mac that has a solid state drive (SSD) and uses macOS 10.13 or later, choose APFS or APFS (Case-sensitive).
If the disk image will be used with a Mac with macOS 10.12 or earlier, choose Mac OS Extended (Journaled) or Mac OS Extended (Case-sensitive, Journaled).
If the disk image will be used with a Mac or Windows computer and is 32GB or less, choose MS-DOS (FAT); if it's over 32GB, choose ExFAT.
To encrypt the disk image, click the Encryption pop-up menu, then choose an encryption option.
Click the Partitions pop-up menu, then choose a partition layout.
Click the Image Format pop-up menu, then choose an option:
Sparse bundle disk image: Same as a sparse disk image (below), but the directory data for the image is stored differently. Uses the .sparsebundle file extension.
Sparse disk image: Creates an expandable file that shrinks and grows as needed. No additional space is used. Uses the .sparseimage file extension.
Read/write disk image: Allows you to add files to the disk image after it's created. Uses the .dmg file extension.
DVD/CD master: Changes the size of the image to 177MB (CD 8cm). Uses the .cdr file extension.
Click Save, then click Done.
Disk Utility creates the disk image file where you saved it in the Finder and mounts its disk icon on your desktop and in the Finder sidebar. Instacal 1 7 1 download free.
In the Finder, copy your files to the mounted disk image, then eject it.
Restore the disk image to a disk.
For more information about disk image types, see the manual (man) page for hdiutil.
Create a disk image from a disk or connected device
You can create a disk image that includes the data and free space on a physical disk or connected device, such as a USB device. For example, if a USB device or volume is 80GB with 10GB of data, the disk image will be 80GB in size and include data and free space. You can then restore that disk image to another volume.
In the Disk Utility app on your Mac, select a disk, volume or connected device in the sidebar.
Choose File > New Image, then choose 'Image from [device name]'.
Enter a filename for the disk image, add tags if necessary, then choose where to save it. Iterm 3 2 8 x 8.
This is the name that appears in the Finder, where you save the disk image file before opening it.
Click the Format pop-up menu, then choose an option:
Read-only: The disk image can't be written to, and is quicker to create and open.
Compressed: Compresses data, so the disk image is smaller than the original data. The disk image is read-only.
Read/write: Allows you to add files to the disk image after it's created.
DVD/CD master: Can be used with third-party apps. It includes a copy of all sectors of the disk image, whether they're used or not. When you use a master disk image to create other DVDs or CDs, all data is copied exactly.
To encrypt the disk image, click the Encryption pop-up menu, then choose an encryption option.
Click Save, then click Done.
Disk Utility creates the disk image file where you saved it in the Finder and mounts its disk icon on your desktop and in the Finder sidebar.
Important: Don't create a disk image of a disk that you believe to be failing or that contains corrupted information. The disk image may not serve as a reliable backup.
For technical information about creating a restore disk image, see the Apple Software Restore (ASR) manual (man) page.
Create a disk image from a folder or connected device
You can create a disk image that contains the contents of a folder or connected device, such as a USB device. This method doesn't copy a device's free space to the disk image. For example, if a USB device or volume is 80GB with 10GB of data, the disk image will be 10GB in size and include only data, not free space. You can then restore that disk image to another volume.
In the Disk Utility app on your Mac, choose File > New Image, then choose Image from Folder.
Select the folder or connected device in the dialogue that appears, then click Open.
Enter a filename for the disk image, add tags if necessary, then choose where to save it.
Reverse delete mac. This is the name that appears in the Finder, where you save the disk image file before opening it.
To encrypt the disk image, click the Encryption pop-up menu, then choose an encryption option.
Click the Image Format pop-up menu, then choose an option:
Read-only: The disk image can't be written to, and is quicker to create and open.
Compressed: Compresses data, so the disk image is smaller than the original data. The disk image is read-only.
Read/write: Allows you to add files to the disk image after it's created.
DVD/CD master: Can be used with third-party apps. It includes a copy of all sectors of the disk image, whether they're used or not. When you use a master disk image to create other DVDs or CDs, all data is copied exactly.
Hybrid image (HFS+/ISO/UDF): This disk image is a combination of disk image formats and can be used with different file system standards, such as HFS, ISO and UDF.
Click Save, then click Done.
Disk Utility creates the disk image file where you saved it in the Finder and mounts its disk icon on your desktop and in the Finder sidebar.
For technical information about creating a restore disk image, see the Apple Software Restore (ASR) manual (man) page.
Create a secure disk image
If you have confidential documents that you don't want others to see without your permission, you can put them in an encrypted disk image.
Note: If you want to protect the contents of the system disk, turn on FileVault using the FileVault pane of Security & Privacy Preferences.
In the Disk Utility app on your Mac, choose File > New Image > Blank Image.
Enter a filename for the disk image, add tags if necessary, then choose where to save it.
This is the name that appears in the Finder, where you save the disk image file before opening it.
In the Name field, enter the name for the disk image.
This is the name that appears on your desktop and in the Finder sidebar, after you open the disk image.
In the Size field, enter a size for the disk image.
Click the Format pop-up menu, then choose a format:
Will sims 3 work on mac. If you're using the encrypted disk image with a Mac computer using macOS 10.13 or later, choose APFS or APFS (Case-sensitive).
If you're using the encrypted disk image with a Mac computer using macOS 10.12 or earlier, choose Mac OS Extended (Journaled) or Mac OS Extended (Case-sensitive, Journaled).
Click the Encryption pop-up menu, then choose an encryption option.
Enter and re-enter a password to unlock the disk image, then click Choose.
WARNING: If you forget this password, you won't be able to open the disk image and view any of the files.
Use the default settings for the rest of the options:
Click the Partitions pop-up menu, then choose Single partition - GUID Partition Map.
Click the Image Format pop-up menu, then choose 'read/write' disk image.
Click Save, then click Done.
Disk Utility creates the disk image file where you saved it in the Finder and mounts its disk icon on your desktop and in the Finder sidebar.
In the Finder , copy the documents you want to protect to the disk image.
If you want to erase the original documents so they can't be recovered, drag them to the Trash, then choose Finder > Empty Trash.
When you've finished using the documents on the secure disk image, be sure to eject the disk image. As long as it's available on your desktop, anyone with access to your computer can use the documents on it.
To access the data in a disk image, double-click it. It appears on your desktop, and you can add, remove and edit files on it just as you would with a disk.