dd over ssh

Save local disk to remote

dd if=/dev/sda | gzip -1 - | ssh server dd of=image.gz
# or
dd if=/dev/sda | gzip -1 - | ssh server "gzip -d - | dd of=image"

Save remote disk to local

ssh server "dd if=/dev/sda | gzip -1 -" | dd of=image.gz

Methods for monitoring

Login via ssh in another terminal and ls -l the file to see what it's size is.
You can use pv to monitor the progress of a large dd operation, for instance, for the remote example above, you can do:

$ dd if=/dev/sda | gzip -1 - | pv | ssh user@local dd of=image.gz

Send a "SIGUSR1" signal to dd and it will print stats. Something like:

$ pkill -USR1 dd

dd 磁盘格式转换

dd => vmdk

apt-get install qemu
qemu-img convert -O vmdk imagefile.dd vmdkname.vmdk


-p  display progress bar (compare, convert and rebase commands only).  If the -p option is
           not used for a command that supports it, the progress is reported when the process
           receives a "SIGUSR1" or "SIGINFO" signal.

Last update: 2020-07-23 07:37:45 UTC