Was in a little jam today and we needed to take backups of a couple of systems. The problem was the local drives didn’t have enough space to take a full disk image. This system was also failing to mount a file system over NFS due to some firewall issues. I had my mind set on taking down the hosts and either using partimage or clonezilla, which I know for sure would have worked. I’m sure you don’t have to use root and could use unpriv’d user with sudo. I’ve used this with tar a bunch of times and was quite amazed when dd worked with it.
$ sudo dd if=/dev/cciss/c0d0 | ssh root@backupserver 'dd of=/some/backup/path/disk.img'
How you can dd a image file directly from within a tar.gz archive.
$ sudo tar xzOf filename.tar.gz | dd of=/dev/sdb bs=1M
How to dd an image from one host and pipe over ssh to remote host
1 |
$ sudo tar xzOf filename.tar.gz | ssh root@remoteshost "dd of=/dev/sdb bs=1M |
-O = extract files to standard out
How to create a tar.gz from a directory and pipe over ssh
1 |
$ sudo tar zcvf - whateverdirectory | ssh root@backupserver "dd of=/some/backup/path/filename.tar.gz" |