Cloning to an external system disk

FreeBSD-10.2 i386 Desktop
Can I clone the OS system disk to an external disk through a USB connection? Then use that disk, /dev/da0 internally to replace the original system disk?

Thanks!
 
You can generally clone a BSD system with the simple but powerful synchro tool sysutils/cpdup, no need to launch a painful block to block cloning. This method is more flexible as it allows you to clone two different sizes of partition (because this is not a cloning per se, this is a simple copy/synchro of files, cloning generally means a block to block copy, so partitions must have the same sizes and operation is quite long).

You must prepare you external disk with gpart, newfs and use glabel to give a name to each target partitions so you can further recall them in fstab or command line with /dev/label/label_of_the partition instead of /dev/da0s1a because I guess that you will remove further the drive from the USB enclosure and connect directly to sata, so the device name will change. With the 'labels', you will be able to make a test boot of the copy on the usb port before connecting it to sata, and so you won't have to change again fstab.

The process is very simple, you can do a live copy. You mount each target partition to /mnt/hdd1, /mnt/hdd2... and for example

cpdup -i0 -s0 / /mnt/hdd1 => for root partition
cpdup -i0 -s0 /var /mnt/hdd2 => for VAR partition etc etc

cpdup by default is clever enough not to cross the junctions. So when you synchro the root directory / it will not copy the content of mounted partition /var if any. It will just create the /var directory.

Ideally you should "clone" by booting on a FreeBSD system on an external device as a LiveCD or Live USB key containing the cpdup tool and mount/synchro one after the other each couple of source/target, but in my experience live copy works very well, just think to stop all non necessary services as Samba server during the duplication.
 
Last edited by a moderator:
Back
Top