0

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?

0

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.

  • I tried and it worked (copy on read only) but some of my pics are broken I just thought that ddrescue could at least save some of them. One time it did it. One last thing: you talk about partition, so you think I could make a partition and do a ddrescue that output an image that is big as the partition and not as the entire disk? Maybe I didn't understand (the failed drive was almost full before the failing but I menage do delete many useless thing because I thought that ddrescue didn't look for them) – Psygno Dec 6 '18 at 8:39
  • The partitions are a fixed size, resizing or moving one usually needs a lot of reads & writes, you don't want to do that before copying all your data, if the drive is failing. gnome-disk-utility or gparted or fdisk -l show partition sizes nicely, they're they the 1, 2, 3... devices in /dev/sda1, /dev/sda2 while the entire drive is just /dev/sda. If you only want data from /dev/sda2 you could ignore the other partitions. ddrescue just reads every sector or a device (drive or partition), free space and files alike. Photorec only tries to read data... but if the files are corrupted... – Xen2050 Dec 6 '18 at 10:37
0

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"
  • Welcome to Super User! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – bertieb Dec 5 '18 at 9:37

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.