Backup Disk Images to Another Ubuntu Box

I wanted to backup my mining rig disk images to another machine with the hopes that I could easily load the images to extract files. The following works well for home directories that are not encrypted. For directories that are encrypted, I am currently copying files out selectively – not sure if there is a better way. But, what follows works for copying unencrypted disk images over SSH and then mounting them on another machine.

Determine the path for the filesystem you want to backup:

$ df

On the machine you want to backup:

$ sudo dd if=path/from/df | gzip -c --fast | ssh user@ip 'dd of=~/path/to/backup.dd.gz' &

Then to mount the image on the receiver:

$ gunzip -c backup.dd.gz >backup.dd
$ sudo mkdir /mnt/disk_image
$ sudo losetup --partscan --find --show backup.dd
$ sudo mount /dev/loop0 /mnt/disk_image

To unmount after:

$ losetup -d /dev/loop0

References 1 2 3 4