As a SysAdmin I sometimes need to make quick backups of a filesystem to a remote machine. Unix provides easy and quick ways to do this task.
The following command line uses dd – destroy disk command
– to copy the content of /dev/hda11 and send the output to gzip and copy the resulting compressed file to the remote machine through ssh. The syntax is as follows:
dd if=/dev/hda11 | gzip | ssh user@remote_server dd of=/dest/path/hda11.gz
Note that /dev/hda11 should not be mounted (not accessed while backing up).
To restore the backed up filesystem do the following:
dd if=hda11.gz | gzip -d | ssh user@remote_host dd of=/dev/hda11
And your done! Quick and dirty backup for you.