I need to interrupt and restart a Linux copy operation. What is the best way to do this?

I'm currently in the process of copying data from one Debian PC to another. I started this via sshfs and tar as follows, but there are no requirements to use sshfs nor tar if another reliable way will suffice:

local$ mkdir /path/to/remote-sdb1
local$ sshfs root@remote:/mnt/sdb1 /path/to/remote-sdb1
local$ tar cf - /path/to/local/data/to/copy | tar xf - -C /path/to/remote-sdb1 &

The remote box is a one-time boot of System Rescue CD with no local operating system and inside my firewall, so I'm not too concerned about logging-in as root until someone comments otherwise.

This is taking longer than I originally expected, so I need to interrupt the operation to power down the remote box for a few minutes.

When I power it back up, I know I can't resume the tar operations; instead, is there something like an rsync command that will let me resume easily from where I left off and finish the transfer, including completing the botched transfer of the file in-progress at the point I interrupt the operation?

After this completes, I plan to run the rsync command in this answer to verify the transfer completed successfully, unless someone recommends this is redundant:

local$ rsync -niaHc /path/to/local/data/to/copy/ /path/to/remote-sdb1/path/to/local/data/to/copy

(As stated in the post, I need to be careful to end the first folder name with a /.)

1 Answer 1


You can't, exactly, because the files in the source dir might be different than they were originally. I.e. rsync will download the newer versions of the files.

To resume it, in general, repeat the same command.

Unless you used --partial, incomplete files won't be left in your directory, so just repeat the same command -- files that have already been transferred won't be transferred a 2nd time, and ones that haven't been transferred will be transferred.

BTW, what I always use, as a matter to make sure I don't end up sending a 2nd copy of my source into the destination, is I 1st make sure the destination directory is created. Then use:

rsync <options> source/. dest/.

That way, (assuming you are using some recursive option), it will make sure to copy contents of source into contents of dest.

You must log in to answer this question.

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