I have a failed hdd (seagate 1Tb) with bad sector. I want to make an image of it with ddrescue. The problem is that I don't have a 1tb hdd to put the image on. The files that I have to rescue are just 90gb. So. Can I shrink the hdd and use ddrescue on one partition so the result image is of 100gb maximum?
2 Answers
Maybe you can compress the image on-the-fly by piping to gzip or other compression? https://serverfault.com/questions/52260/compressing-dd-backup-on-the-fly
Something like
sudo bash -c "dd if=/dev/sda2 | gzip > /media/disk/sda2-backup-11december18.gz"
- 1
Is the drive still actively failing, getting worse, making weird noises, etc?
If not, and it's still readable (aside from a single bad sector) and mountable, why not just quickly mount it read-only / ro (don't boot from it) and copy the files you want. Or if it's not mountable, use a program like testdisk that might be able to copy only a few files. Or maybe photorec, though it tries to read an entire device but only saves the found files.
If the drive does sound bad and has errors all over the place, you should really get another backup drive that's big enough to store the image, see Why is it impossible to compress on the fly images by ddrescue? If you want the entire drive, you'll just have to beg/borrow/buy a big enough drive, even just for a few hours. You can compress the image after ddrescue is finished creating it, but watch out for compression that doesn't allow on-the-fly access like gz, xz, etc... squashfs might work.
Or maybe you're in luck and the single partition you want to backup is small enough for your storage, after all it can't be any larger than the entire drive.
- 14,391