1

I have a hard drive with a bad PCB board. It stays on when not under heavy load and it will restart if I copy too much data off it. So far I have had good luck doing folders under 500 MB in size if I copy one folder to my good hard drive, wait five minutes, copy another, etc.

If I mount the bad drive and try to copy a folder of several GBs in size it will start and then stop as the hard drive restarts. When I try to mount the drive again Linux says it can't read the superblock. I have several folders with over 30 GB of data in many different folders.

What I am looking for is a way of copying a folder in Linux such that the commands grab the whole folder in chunks with a timed break in-between.

3 Answers 3

4

You could stop the copy process after some time:

cp -R srcdir destdir &
sleep 10
kill -STOP $PID_OF_CP
sleep 10
kill -CONT $PID_OF_CP
3

If a slow transfer (i.e. no pauses, but low data rate) will work, then something like this should do. The tar commands pack all the files into one data stream, and the pv command limits the data transfer rate of that stream.

tar cf - <source> | pv --rate-limit 1m | (cd <destination> && tar xf -)

I haven't tested this myself, so the syntax may be a little off.

-1

you may first minimize the file weight to be transfered by using the maximum gzip compression, then rsync the tarballs with a timeout option. Also you can run rsync a second time in case your nice disk fade out. Rsync would look at the files in both locations and copy the difference : it would continue the copy from the point the sync was interrupted.

You must log in to answer this question.

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