We help IT Professionals succeed at work.

Untarring archive over lan via ssh stalling/failing

Hello Experts!

I needed to restore a directory from backups on my workstation.  My backups are tar archives on my backup server. I tried the following command" cat cmottus01-Tue-differential.tgz - | ssh cmottus01 "cd /;tar zxvf - home".  The command seemed to work fine as I could watch many files being restored, however after a couple of minutes the process would stop.  When I would check top, the tar, gzip and ssh processes would be stopped.  There was plenty of room on the disk and I let it go all night and it was still stalled the next morning. Eventually I copied the archives to my workstation and restored locally and it worked perfectly.

Why would the process stop?
Comment
Watch Question

Commented:
try scp the file to the remote server first and the execute the tar command locally, at least that would help you troubleshoot.

Author

Commented:
I did do it locally.   Thats how I got it too work. It untars great if I do it locally.  The problem was that my workstation did not have enough disk space for the newest incremental.tgz and the untarred directory.  Thats why I tried using this method.
PĂ©tur Ingi EgilssonSoftware Engineer -- Consultant

Commented:
execute the tar command on the remote server.
copy all your files over to your computer with scp or rsync
delete the files from the remote server

Author

Commented:
Thank you for you answers, but I understand all that.  What I am curious about is why untarring fails when I am doing it via an ssh to a remote server.
nociSoftware Engineer
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
ssh might interpret some data if you use it like this... It act uponm some ~{char} sequences
as you probably need to set the escape charater (~) to none.
option on the command line -e none
or in the ~/.ssh/ssh_config file "EscapeChar = none"

Disabling the escapechar should make your session 'tranparant'
see also man ssh.
Software Engineer
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
BTW. If security is not the reason why you started with ssh. then nc (netcat) or sokat
might be faster replacements for transporting sockets over a network.

Author

Commented:
Netcat did the trick!  Awesome!

On my workstation I opened port 6666 and then changed to the target directory.  I then entered "# nc -v -w 30 -p 6666 -l | tar zxvf - home" at the command prompt and hit enter.

On the backup server I changed to the directory with the archives and entered the following command "nc -v -w 2 workstation01 6666 < Backup-Sun-full.tgz" and hit enter.

The archive was streamed from my backup server to my workstation and untared to the target directory. I also refered to http://www.oreilly.com/pub/h/1058 for the command syntax.

Cheers noci!

Explore More ContentExplore courses, solutions, and other research materials related to this topic.