# ddrescue -d -r3 --cpass=1,3-4 /dev/sda output.img output.mapfileHere’s what this does:
-
-dtells ddrescue to use direct disk access and ignore the kernel’s cache. -
-r3tellsddrescueto retry bad sectors 3 times before giving up. Note: On a failing drive you may want to eliminate this option the first time so as to not waste time hammering on bad sectors and risking drive failure. You can always use the mapfile to go back and retry the bad sectors after you get an image from the first sweep. -
--cpassselects what pass(es) to run during the copying phase. Valid pass values range from 1 to 5. To run only the given pass(es), specify also--no-trimand--no-scrape.--cpass=0skips the copying phase entirely. -
/dev/sdais the drive we are rescuing…the whole disk. Naturally, if you just wanted a specific partition, you would use something like/dev/sda1instead. -
output.imgis the name of the image file. -
output.mapfileis the name of the mapfile. Always use a mapfile. This allows you to resume an interrupted image at the point you left off, or to retry bad sectors after an initial pass. Without a mapfile, you will have to start over again!
Install a GNU/Linux OS based on the 2.4 Linux Kernel (e.g. CentOS 3.9).
Environment:
| Software | Version |
|---|---|
| Linux kernel | 2.4.21-50 |
| gcc | v3.2.3 (20030502) |
| glibc | v2.3.2-95.50 |
| make | v3.79.1 |
Download the ddrescue source code.
Compile the binary with the an static linked libraries flag:
./configure LDFLAGS="-static"
make
make installTestDisk & PhotoRec's Source code
Run:
brew install testdisk
photorec
Foremost's Source code
Run:
brew install foremost
foremost -i /dev/disk2s1
foremost -i /dev/disk2s1 -a # include partially recovered files
foremost -i /dev/disk2s1 -t gif,pdf
foremost -i /dev/disk2s1 -c foremost.conf
foremost.conf:
# extension case-sensitive-header? max-file-size header optional-footer
bak y 3000000000 \x54\x41\x50\x45