How to Verify & Repair Mac Disk from Command Line

Nov 8, 2023 - Leave a Comment

Mac Terminal icon

The Disk Utility application on MacOS has a command line counterpart, that allows Mac users to run disk maintenance and disk administration tasks, including verifying and repairing disks. There are obvious advantages and benefits to using the command line for tasks like this, particularly for troubleshooting scenarios, and remote management, but some advanced users may also simply prefer to use the command line rather than the GUI app of Disk Utility.

Let’s review how you can use the Mac command line to verify a disk on your Mac, and repair it if necessary.

How to Verify Volumes / Disks on Mac from Command Line

First, let’s review how to verify a disk volume from the command line:

  1. First, open the Terminal application on your Mac
  2. Enter the following command to identify your disk to verify:
  3. diskutil list

  4. Hit return and locate the disk identifier for the disk you want to verify
  5. Now enter the following command to verify the disk:
  6. diskutil verifyVolume /dev/diskID
    For example if the volume ID to verify is disk3s1 you would use the following syntax:
    diskutil verifyVolume /dev/disk3s1

  7. Let diskutil complete it’s task, you’ll see a message stating if everything is OK with something along the lines of “The volume /dev/rdisk3s1 with UUID 28FA appears to be OK”, or if a repair is needed it will say so

You can repeat this process with other disks and volumes, including external volumes that you connect to the Mac.

You can also verify the entire disk and partition map by using the ‘verifyDisk’ flag instead of ‘verifyVolume’.

How to Repair Disks from Command Line on Mac

If the volume must be repaired for whatever reason, you can do so with the following command:

diskutil repairVolume /dev/diskID

Again using the example where /dev/disk3s1 is the volume ID to repair, the syntax would then be:

diskutil repairVolume /dev/disk3s1

Or, if you need to repair the entire disk, you can use the ‘repairDisk’ flag instead. Note that if you need to repair the entire disk, and the disk needing repair is a boot disk, you will need to boot from another drive, or from Recovery Mode, to be able to successfully repair the full boot disk.

For most users, using Disk Utility is the way to go, but there are many valid reasons to want to verify and repair disks from the command line on a Mac. From remote management, to troubleshooting, to mere preference, the Terminal approach offers many benefits to advanced users.

.

Related articles:

Posted by: Paul Horowitz in Command Line, Mac OS, Tips & Tricks, Troubleshooting

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site