Re: bash script: move large LV to another machine
Ed Heron <[email protected]> Fri, 16 Sep 2011 12:22:42 -0600
| Newsgroups | gmane.org.user-groups.nmlug |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 2011-09-16 at 11:43 -0600, Ed Heron wrote:
> ... I'm going
> to change my script to create a temp file, copy the file and dd the
> piece. ...
My script appears to work...
--------------------
src_dev='/dev/vg/lv'
dst_addr='192.168.2.2'
dst_dev='/dev/vg/lv'
src_size=3200
src_blk=0
while [ $src_blk -lt $src_size ]
do
echo -n " $src_blk"
src_md5=`dd if=$src_dev bs=32M skip=$src_blk count=1 2>/dev/null |
md5sum`
dst_md5=`ssh $dst_addr "dd if=$dst_dev bs=32M skip=$src_blk count=1
2>/dev/null | md5sum"`
if [ "$src_md5" == "$dst_md5" ]
then
echo -n "+"
let src_blk=src_blk+1
else
echo -n "-"
dd if=$src_dev of=vd-sync.tmp bs=32M skip=$src_blk count=1
2>/dev/null
scp vd-sync.tmp ${dst_addr}:. >/dev/null
ssh $dst_addr "dd conv=notrunc,fdatasync if=vd-sync.tmp of=$dst_dev
bs=32M seek=$src_blk count=1"
fi
done
----------
I'm very annoyed that creating a temp file works but piping the read
dd to the write dd doesn't. Obviously, my knowledge has a hole in it.
_______________________________________________
NMLUG mailing list
[email protected]
http://lists.b9.com/cgi-bin/mailman/listinfo/nmlug