I am trying to repair an external hard drive that is showing up under diskutil list
and the Disk Utility app, but says "First Aid process has failed. If possible back up the data on this volume. Click Done to continue.". I have tried these things:
$ diskutil list
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *251.0 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_APFS Container disk1 250.8 GB disk0s2
/dev/disk1 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +250.8 GB disk1
Physical Store disk0s2
1: APFS Volume Macintosh HD 243.7 GB disk1s1
2: APFS Volume Preboot 22.6 MB disk1s2
3: APFS Volume Recovery 515.0 MB disk1s3
4: APFS Volume VM 2.1 GB disk1s4
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk2
1: EFI EFI 209.7 MB disk2s1
2: Apple_HFS MyDisk 999.8 GB disk2s2
$ diskutil repairDisk /dev/disk2
Repairing the partition map might erase disk2s1, proceed? (y/N) y
Started partition map repair on disk2
Checking prerequisites
Checking the partition list
Adjusting partition map to fit whole disk as required
Checking for an EFI system partition
Checking the EFI system partition's size
Checking the EFI system partition's file system
Checking the EFI system partition's folder content
Checking all HFS data partition loader spaces
Checking booter partitions
Reviewing boot support loaders
Checking Core Storage Physical Volume partitions
The partition map appears to be OK
Finished partition map repair on disk2
$ sudo gpt recover /dev/disk2s2
gpt recover: unable to open device '/dev/disk2s2': Resource busy
$ sudo diskutil mount readOnly /dev/disk2
Volume on disk2 timed out waiting to mount
$ sudo mkdir /Volumes/USB
$ sudo mount -t hfs /dev/disk2 /Volumes/USB
mount_hfs: error on mount(): error = -1.
mount_hfs: Resource busy
$ diskutil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful
$ diskutil eject /dev/disk2
Volume timed out while waiting to eject
What else can be done to fix this, at least to get it readonly so I can copy the data out of it to another drive.
https://github.com/gcunhase/PaperNotes/blob/master/notes/mymacnotes.md