I am trying to tar a huge directory (with about 600GB) and sometimes my SSH conection drops and I need to execute the tar code again and my linux overwites the previous file beginning all the tar again.

Is there some parameter that allows my tar file to be resumed after some problem?

  • 4
    Run your command in "detach terminal" with nohup : nohup command </dev/null & – LinuxDevOps Apr 23 '14 at 20:04
  • Also you could use the 'at now' command if the at capability is enabled. – mdpc Apr 23 '14 at 22:00
  • 1
    man screen...you will find it quite useful – Grant Apr 23 '14 at 22:28

Is there some parameter that allows my tar file to be resumed after some problem?


What you should do, though, is run your command from within a terminal multiplexer like screen or tmux. That way if your connection drops, the process keeps running.

  • 3
    Or use nohup command – Brian Apr 23 '14 at 20:04
  • nohup command will keep the proccess after I close my SSH window? I use putty, so after I close putty it will keep the process? – amandanovaes Apr 23 '14 at 20:23
  • @amandanovaes This answer explains what happens when your terminal disconnects. (shameless self plug) – Andrew B Apr 23 '14 at 20:28
  • I dont know what is a terminal multplexer! That's why I think that maybe nohup is a much better solution but I want to make sure I understand it. – amandanovaes Apr 23 '14 at 20:47
  • 5
    @amandanovaes - if you're doing linux sysadmin, you need to know what screen and/or tmux do. They are essential tools in your sysadmin toolbox. For may other reasons than just this specific use case. – EEAA Apr 23 '14 at 20:54

Over ssh, I would use rsync. This brings everything over uncompressed, but it will only bring over changed files, which is likely what you want as well. A 600GB transfer will probably have a few connection drops. This recovers automatically.

I've used variants of this script over time. I forgot where it came from, so if the author is found, I would like to give credit.


### Runs rsync, retrying on errors up to a maximum number of tries.
### Simply edit the rsync line in the script to whatever parameters you need.

# Trap interrupts and exit instead of continuing the loop
trap "echo Exited!; exit;" SIGINT SIGTERM


# Set the initial return value to failure false

while [ $? -ne 0 -a $i -lt $MAX_RETRIES ]
 rsync -avz --progress --partial -e "ssh -i /home/youngian/my_ssh_key" /mnt/storage/duplicity_backups backupuser@backup.dreamhost.com:.

if [ $i -eq $MAX_RETRIES ]
  echo "Hit maximum number of retries, giving up."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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