dd

Partition Backups 2016

The name dd is an allusion to the DD statement found in IBM's Job Control Language (JCL), in which the initials stand for “Data Definition”.
In this example we are using the 'dd' command to backup one Linux box to another (both Linux boxes in this example are Raspberry Pi's). Backups can be done in many ways, generally a backup would be done from one disk to another, probably on the same machine. However for security reasons, having the working disk and the backup disk on the same server is a no no.
Both the servers in this example have the same credentials, so usernames and passwords are the same. This backup method is a Pull system where the backup server pulls the files from the primary server.

sudo ssh root@172.16.10.109 "sudo dd if=/dev/sda | gzip -1" | dd of=test.gz

The command logs in to the primary server, then runs the dd command, the output is piped to a gzip file, then transferred to the backup server.
Note the 'sudo' part halfway along the command line, this is required to give super user access of the primary server to the backup server user.
sudo ssh pi@192.168.1.9 “sudo dd if=/dev/sda | gzip -1” | dd of=test.gz