3

As the title says, I’d like to copy everything from a failing 4TB external USB drive to a new 4TB USB drive.

The complication is, I’m not sure how different programs handle errors.

Also, being that this is likely to take quite a long time, I’d like to copy the data while keeping the drive mounted; New files will be added, but no files will be altered if that makes any difference.

I’ll be working from the command line.

Update: As suggested, I’m giving rsync a try using additional advice from here.

sudo rsync -aAXv --log-file=/home/osmc/rsync.log --exclude={"/lost+found"} /mnt/Main/* /mnt/NewMain

Will update on how it deals with errors when finding them.

2 Answers 2

1

If you are able to forego the requirement of keeping the drive and its filesystem mounted: Boot from an external medium to ensure that the disk is inactive (or take the drive out and stick it as a slave in another machine), and then use ddrescue on each (important) partition:

ddrescue /dev/sdb1 /mnt/some/large/storage/sdb1backup logfile

This'll create an image of the partition which can then be mounted:

mount -o loop /mnt/some/large/storage/sdb1backup /mnt/image 

ddrescue works like dd, with the most visible exception is that it is a lot more verbose. I highly recommend skimming the manpage for options relevant to your case. The logfile allows you to do multiple runs and skip the sectors that have already been retrieved successfully.

If you absolutely must have it up and running: rsync -Pravdtz /files somehost:somefolder/

3
  • ddrescue was the first place I turned, actually. I went through the whole process of compiling and installing and started it copying the drive. Until I judged that the estimate of 2 days 11 hours wasn't going to significantly change once it got going. That's a long time to keep the drive unmounted in my case.
    – leetwanker
    Dec 4, 2015 at 0:01
  • @Jarmund - ddrescue is absolutely the correct tool for the job - it should be added that unlike DD it will retry blocks and keep trying to get data off as long as possible. Its often a good idea to run it forward, then when it starts going slowly, abort it and restart with "-r" so it recovers from the end, often leaving the bad blocks till after its got the lions share of good stuff. 2 days is not a lot of time to try and recover a 4TB disk.
    – davidgo
    Dec 4, 2015 at 1:53
  • No, I don't think it's a lot of time to try to recover a drive that size, but I'm not trying to recover any data from bad sectors, I just want to skip them. Hopefully rsync will tell me what files it has problem with.
    – leetwanker
    Dec 4, 2015 at 4:41
1

The answer suggesting I use rsync is gone so I'm answering it myself. Thanks for the tip.

I’m giving rsync a try using additional advice from here.

sudo rsync -aAXv --log-file=/home/osmc/rsync.log --exclude={"/lost+found"} /mnt/Main/* /mnt/NewMain

It took quite a long time to complete but I was able to continue to use the system and even read and write files to the drive during. The errors it ran into were logged and retried again at the end. I ended up losing a few files but nothing that was very important to me.

This probably won't suit everyone's needs but it did exactly what I needed.

You must log in to answer this question.

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