Disclaimer: I am the original author of WereSync
WereSync can clone a running drive. It will also clone to a drive of a different size, including a smaller one if need be.
Install with pip
:
pip install weresync
Then run the program with root permissions. It needs root permissions because it has to access your block devices in order to copy. The following is for a GPT partition table:
sudo weresync -C --grub-partition 2 --efi-partition 1 /dev/sda /dev/sdb
This command will make a bootable clone of /dev/sda on /dev/sdb. The -C
flag marks that the target drive may not have the same partition scheme as the source drive. If the check fails, WereSync
will repartition the target drive so it matches the source drive. After your first backup, you probably want to remove this flag, since the checking mechanism sometimes returns false positives and will erase the previous backup. WereSync backs up incrementally, so it's faster if you have the previous backup intact.
The --grub-partition
flag should be passed the partition number for the partition on which grub should be installed. This is usually the partition mounted on /
. So if you have /dev/sda2 as your root partition, pass --grub-partition 2
to WereSync.
The --efi-partition
flag is only relevant to UEFI systems. It should be the number of your efi partition. If your efi partition is on /dev/sda1 pass --efi-partition 1
to WereSync. To find your efi partition use sudo parted /dev/sda p
and look for the partition with the "boot" flag. It's number is in the far left column.
If you have your boot directory on a seperate partition, you will need to pass that partition's number to the --boot-partition
flag.
This command will erase all data on /dev/sdb, so be sure to save any data you want from there. More documentation and command line options can be found at the WereSync documentation.
WereSync uses rsync, as mentioned in the question, but automatizes the process of copying. It will also update your fstab and reinstall grub to make the clone bootable. However, because of the variance of Linux systems, certain setups may not work properly.
Because of using rsync, clones made with WereSync will be update incrementally, greating increasing the speed of clones.