3

I have a 2.7T hard drive that has been causing some problems lately, so I've bought a new 3.6T disk.

The old drive contains about 2.4T of data (lots of files are hardlinked) in a single ext4 file system.

The normally recommended method I can see of fixing this kind of problem is to make an image of the disk using ddrescue. However this image file would naturally be 2.7T in size, leaving 0.9T space left. I have an additional 0.5T of space on other disks, but this is obviously not enough to copy the data out of the image.

I don't know where I would find an additional 1T of space to put the rest of the files. So obviously I need to find some other method.

  • One possible method could be to write the image directly to /dev/sd?1 on the new disk, and just resize it. However this sounds dangerous, since it might leave the new disk with a broken file system.
  • Maybe some rsync or cp -a command could solve this problem? Certain other answers mention that rsync could possibly break the disk, but maybe there are options to make this less likely to happen.
  • Maybe there exists some utility that copies the data out of the image, while shrinking the image file in the progress?

What is the best way of copying the data from the old disk to the new disk? I am thinking that a command like the following might do it:

rsync -aHX --info=progress2 --partial /media/ext_drive/* /media/4tb

After mounting the old disk in read-only mode to /media/ext_drive and the new one to /media/4tb.

1
  • If you did do a ddrescue-style image first, you could then read from the image and store files temporarily online somewhere, or beg/borrow a 3rd temporary drive. Compressing a raw disk image is possible (ex. dd if=dev/sda | gzip -9 > dd-image.gz) but reading it becomes problematic. I once found a method that used some type of network server to uncompress the file "on the fly"...
    – Xen2050
    Aug 23, 2017 at 12:00

1 Answer 1

1

If you can connect the new disk to the computer, just clone the old disk directly to the new one. If you have no internal bay available for the new disk, you could get a USB enclosure to put it in (the copy would only be slower).

One tool that can help is the free Clonezilla.

9
  • Both disks are external usb-3.0 disks.
    – Alice Ryhl
    Aug 23, 2017 at 10:47
  • Disk-space considerations dictate a disk-to-disk copy. You may use a specialized program like Clonezilla or any other method - the speed gain is not worth the time that passes, as the disk may degrade even more.
    – harrymc
    Aug 23, 2017 at 10:55
  • okay I've started copying files, however I am only gaining speeds at around 1-2 MB/s, and it looks like it going to take several days this way. I'm not sure what can be done, though.
    – Alice Ryhl
    Aug 23, 2017 at 11:05
  • You may get some hints from this post or try Clonezilla Live which won't be limited by the operating system.
    – harrymc
    Aug 23, 2017 at 11:26
  • @AliceRyhl it sounds like you're copying files one at a time, not doing a whole disk image. FYI cp or even cat and > can "clone" a disk/partition, but ddrescue is the deluxe way, it should be available in your favourite linux distro already, if you're more comfortable with one
    – Xen2050
    Aug 23, 2017 at 12:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .