Welkom bij Bandhosting.nl,
hosting en webdevelopment.

Rescue faulty harddrives with ddrescue

If a certain external or internal harddrives give you issues, you can use ddrescue to extract a backup from it (for as far as data isn't damages by broken sectors yet).

First you'll need to find out the exact identifiers using the diskutils application on OSX:

diskutil list

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk2         121.1 GB   disk0s2

/dev/disk1 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *3.0 TB     disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:                 Apple_APFS Container disk2         3.0 TB     disk1s2

/dev/disk2 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +3.1 TB     disk2
                                 Physical Stores disk0s2, disk1s2
   1:                APFS Volume Macintosh HD - Gegevens 2.3 TB     disk2s1
   2:                APFS Volume Preboot                 33.0 MB    disk2s2
   3:                APFS Volume Recovery                496.6 MB   disk2s3
   4:                APFS Volume VM                      8.6 GB     disk2s4
   5:                APFS Volume Macintosh HD            11.0 GB    disk2s5

/dev/disk3 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk3
   1:       Microsoft Basic Data Elements SE             1.0 TB     disk3s1

/dev/disk4 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        +1.9 TB     disk4
   1:                        EFI EFI                     209.7 MB   disk4s1
   2:                  Apple_HFS Time Machine-reserve... 1.9 TB     disk4s2

In my case, I want a backup from /dev/disk3 (the external drive I've connected to my Mac). You can put ddrescue to work with the following command:

sudo ddrescue /dev/disk3 Backup.iso backup.log

It will ask you for you user password, and then present you with a status output:

GNU ddrescue 1.24
Press Ctrl-C to interrupt
Initial status (read from mapfile)
rescued: 999590 MB, tried: 580236 kB, bad-sector: 557026 kB, bad areas: 25287

Current status
     ipos:   33178 MB, non-trimmed:        0 B,  current rate:       0 B/s
     opos:   33178 MB, non-scraped:   12555 kB,  average rate:       2 B/s
non-tried:        0 B,  bad-sector:  564962 kB,    error rate:       8 B/s
  rescued:  999593 MB,   bad areas:    25434,        run time: 12d  4h  1m
pct rescued:    0.00%, read errors:    15500,  remaining time:         n/a
                              time since last successful read:      6m  4s
Scraping failed blocks... (forwards)

For larger disks, it can take a long time for a backup to be completed. Luckily, you can stop and start the process with the above command as often as you want. It will just resume where it left off.