clone a disk

Simon Hobson linux at
Fri Jul 17 18:21:51 UTC 2015

Thierry Granier <th.granier at> wrote:

> i have a machine A with 2 disks 1 et 2 running Debian Jessie
> on 1 is the system and the boot and the swap
> on 2 different partitions like /home /opt ETC.....
> i have a machine B with 1 disk running kali-linux and 100G free
> Can i clone the disk 1 of machine A on the 100G free on machine B with rsync?
> If it is possible, how to do that?

Yes, it's easy to do, I do that for the primary backup on all my systems.

Lets say you are doing it from machine a, and backing up to directory /backup_a on b. Logged in as root then you could do it with :
rsync -avH --delete --exclude-from=/etc/rsync_excludes / root at b:/backup_a/
-a means "archive" and sets several parameters, v simply makes things verbose, H means correctly handle hard linked files. --delete means delete files from the destination that have been removed from the source, and --exclude-from specifies a file containing a list of exclusions to omit.
You need to exclude a bunch of stuff, things like /dev/*, /proc/*, /sys/*, and so on. You can also exclude things you don't want to copy such as log files.

However, this is interactive and also needs permission to log in as root on the destination (which I block for security). Far better, for regular backups, to use rsync as a service on the destination which only needs a few more steps.

Also note that trailing "/"s on source and destination are significant. root at b:/backup_a/ will produce different results to root at b:/backup_a !

More information about the rsync mailing list