dd over ssh oddness

So, using the command:

root@new# ssh root@old dd if=/dev/vg/somedisk | dd of=/dev/vg/somedisk

appears to fail, getting a SIGTERM at some point for no discernable reason... however, using

root@old# dd if=/dev/vg/somedisk | ssh root@new dd of=/dev/vg/somedisk

works fine.

The pull version fails at a fairly random point after a fairly undefined period of time. The push version works everytime. This is most confusing and odd...

Dear lazyweb, please give me some new ideas as to what's going on, it's driving me nuts!

Update: solved...

A different daemon wasn't limiting it's killing habits in the case that a certain process wasn't running, and was killing the ssh process on the new server almost at random, found the bug in the code and now testing with that.

Thanks for all the suggestions though, much appreciated.

Posted: 2013-12-03 10:59 in Tech | permalink | Comments: 8

sebseb - 2013-12-03 12:04

Could be due to ssh escape char. You could try using root@new# ssh -e none root@old dd if=/dev/vg/somedisk | dd of=/dev/vg/somedisk ++

Brett Parker - 2013-12-03 13:01

Unfortunately, that doesn't fix it :(

rda - 2013-12-03 13:07

just a wild guess: can it be that in the second version ssh does some buffering for you (keeping the connection alive). and: what does strace tell you about the sigterm?

douglas - 2013-12-03 13:20

It might be useful to know which process got the SIGTERM. There are 5 processes involved (I think): bash, ssh, sshd, and 2 dd's btw, have you tried a bigger blocksize, e.g. bs=1M?

Steven C. - 2013-12-03 13:34

See how much memory ssh allocates; maybe run ssh under /usr/bin/time It maybe doesn't stop new data coming in from the remote side, and if the output side is slower, the ssh client buffers it until hitting some memory limit?

CArsten - 2013-12-03 13:49

Also, you may want to use mbuffer on either side just for the fun of watching where if at all a botteneck is (added value it may tell you which side broke the connection)

Yoko - 2013-12-03 16:15

I use netcate instead of ssh, it's usefull, but I don't use is on internet.

Bob Proulx - 2013-12-03 22:06

Unrelated to SIGTERM but you should add -n to the ssh to close stdin if you aren't going to be using stdin on the remote host. Because otherwise ssh will read and buffer up stdin on the local machine thinking that it might be used.