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?
Who is Participating?
nociConnect With a Mentor Software EngineerCommented:
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.
try scp the file to the remote server first and the execute the tar command locally, at least that would help you troubleshoot.
PEI_ITAuthor 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.
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Pétur Ingi EgilssonSoftware Engineer -- ConsultantCommented:
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
PEI_ITAuthor 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 EngineerCommented:
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.
PEI_ITAuthor 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!
All Courses

From novice to tech pro — start learning today.