Transferring content of block devices
You could pipe through SSH. Example using dd
:
dd bs=1M if=/dev/disk | ssh -C target dd bs=1M of=disk.img
If the network connection breaks during transfer, you can resume if you know how much was copied. For example if you're sure at least 1000MiB
were transferred already (check the file size of disk.img
):
dd bs=1M skip=1000 if=/dev/disk | ssh -C target dd bs=1M seek=1000 of=disk.img
dd
is just an example, it works just as well with other commands, as long as they work with pipes.
I'd install the buffer program (if it is not already there in your distribution) if you are trying to transfer via an ethernet link. It is like dd but FAR better and faster. Basically it is programmed to do concurrent reads and writes using a shared memory buffer. I used to use this for tape dumps and it saved about 10% transfer time. The command line would be:
buffer -i /dev/disk -m 100m | ssh -C target buffer -o disk.image -m 100m
There are more options available default blocksize is 10K. The above allocates 100MBytes of shared memory, you might have to adjust either this parameter or your configuration to allow this.
WARNING: Transmission of an ACTIVE partition in this manner will be problematic. So make sure that the partition to be transmitted is NOT mounted.