Preamble
Suppose I have an encrypted partition of 1TB on machine A
containing the home directories of a dozen users, let's call this
partition sda2
.
I want to backup that partition on a remote computer B on a daily basis.
To keep it secure and simple, the backup on B must be an exact image copy
of sda2
.
I know I can create a local image of sda2
with the dd
command,
and even pipe it to B through ssh
:
$ dd if=/dev/sda2 | ssh B dd of=/backups/A.sda2.image
The problem with this approach is the sheer size of the partition. 1TB of data doesn't pass through the network easily and this puts a limit on the frequency of backup operations---less than once in a month to be realistic. An incremental backup tool is needed at this point.
rsync
, seems to me, is the solution to the previous difficulty.
However I fail when I try to test it because rsync
treats /dev/sda2
as an special file and the command:
$ rsync /dev/sda2 B:/backups/A.sda2.image
doesn't do what I want.
Question
Is there a way to trick rsync
to treat /dev/sda2
a regular file?
Note
I'm not asking if there is an rsync
option to do this (if there is such an option that would be great, but that's only half of the story)
I want to know if there is something like a mount
command or system call that would allow me to create, for instance, a regular file /mnt/sda2.live_image
with the raw contents of /dev/sda2
, so that
other applications can read or write directly on sda2
through sda2.live_image
.
Any help is much appreciated.