Quickest Cloning of Working Mint System

Print Friendly, PDF & Email

The only command I know of that clones an active system drive is DD, but it is very slow at about 30GB / hr, system specs depending..it can do this unlike rsync or cp -vr because it doesn't get stopped by it's own process in /proc or /sys.

The fastest way I have found to get another clone of your perfectly setup system is by fresh installing a new system from USB image, (10 mins) then using rsync as below to update the missing files from your system drive to the clone. This means MYSQL DB's, updates, home dirs etc. can be transferred as rsync's default is to copy newer files over old ones and as most of your working system's files don't yet exist on the new install, they get transferred also.

After you have fresh installed from USB image to the clone drive, do the full updates to your working system so your files are definitely newer or the same versions as the new install (don't update the new install!!), or use an older installed version from your spare backup drives and mount that on the working system you want to clone. 

All files from the fully workingsystem drive will transfer to the clone-to-be using rsync except those in bold (assuming your spare drive is mounted at /media/home/user, so it doesn't loop copy /media/home/user files over and over until full!).

The excluded are in bold, and {-n=dry-run} ALWAYS!:

 

Note! the UUID number of the system drive will be copied to GRUB /boot/grub/grub.cfg file and /etc/fstab.

Change them before you boot the new drive as it will now have the UUID value of the cloned drive!

sudo blkid

/dev/sdb1: UUID="1341613a-6c85-4b03-837e-d0636ecf6adb" TYPE="ext4" PARTUUID="f4b5a292-01"

It's EASY to edit grub's files in vim:

Replace All cloned drive UUIDs with the new drive's UUID:

sudo vi /media/stevee/de1ea326-7478-4297-8bce-79cb77d682c9/boot/grub/grub.cfg

In vim, press : then add at the :

:%s/oldstring/newstring/g

g for global means substitute every occurrence of "oldstring" on every line.

OR you can edit the GRUB boot menu of the new drive by BIOS booting to it then pressing E at the GRUB menu and removing all references to UUIDs and replace with root=/dev/sdb1 format and change the relevant (hd0,1) formats to the correct partition values and boot with F10 ensuring to sudo update-grub2 once the new drive has booted correctly.