For (b) we can simply use 'dd' and 'ssh'. The general plan is to do
this:
- dd if=/dev/disk | gzip | ssh xenhost 'cat > /var/lib/xen/images/disk.img'
+ dd if=/dev/disk | gzip | ssh xenhost 'zcat > /var/lib/xen/images/disk.img'
If the user doesn't have sshd installed on the Xen host, then they can
also opt for a pure TCP transport:
dd if=/dev/disk | gzip | nc xenhost port
and on the remote host they do:
- nc -l -p port > /var/lib/xen/images/disk.img
+ nc -l port > /var/lib/xen/images/disks.gz
For (c) we can use device-mapper snapshots to mount a ramdisk above
the disks themselves. This allows us to make non-destructive changes
gigs=$(($sectors/2/1024/1024))
echo "Sending /dev/$dev (${gigs} GB) to remote machine"
- dd if=/dev/mapper/snap_$dev |
+ dd if=/dev/mapper/snap_$dev | gzip --best |
case "$remote_transport" in
ssh)
ssh -p "$remote_port" "$remote_host" \
- "cat > $remote_directory/$name"
+ "zcat > $remote_directory/$name"
;;
tcp)
echo "p2v $name $sectors" > header