Mike's PBX Cookbook

Disk Repair

How to repair a hard drive or USB stick in the terminal, when it won't mount or show in Disk Utility:

Before you give up and re-format a suspected bad drive, open Terminal and try this:

1 Attach the drive, and establish it's name: diskutil list

2 Mount the volume by it's identifier: diskutil mount /dev/disk2s1

3 Repair the volume: diskutil repairVolume /dev/disk2s1

Example:

MBPro:~ mike$ diskutil list                         < list attached disks and partitions
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:          Apple_CoreStorage Untitled                499.5 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3

/dev/disk1 (internal, virtual):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            Mac HD                 +499.5 GB   disk1
                                 Logical Volume on disk0s2

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *2.0 TB     disk2
   1:                  Apple_HFS ELEMENTS                2.0 TB    disk2s1

MBPro:~ mike$ diskutil mount /dev/disk2s1           < mount the suspect partition
Volume ELEMENTS on /dev/disk2s1 mounted
MBPro:~ mike$ diskutil repairVolume /dev/disk2s1    < repair it
Started file system repair on disk2s1 ELEMENTS
Repairing file system
:
The volume ELEMENTS was repaired successfully
File system check exit code is 0
Updating boot support partitions for the volume as required
Finished file system repair on disk2s1 ELEMENTS
MBPro:~ mike$
Home » Other » Diskrepair