2

How can I perform a complete clone on an OS and have it installed to another computer kernels and all as close as possible to the original?? Is Clonezilla a good idea?

Source: VB of Oracle Linux 5 (from Oracle Developer Day OVA) Receiver: physical laptop currently running CentOS 6.6 (basically Oracle Linux 6)

2

If the hardware is similar enough, especially same HD device (e.g. /dev/sda) then cloning can be done with dd ( or CloneZilla). After copying the full disc (including bootsector) you should be able to boot the new system.

If there are changes in hardware that preclude a partition to partition copy, or if you want to change filesystem types, then you can copy the files of the various partitions to new partitions that are formatted on the target. But in order to allow to boot that system you need to make sure that your target /etc/fstab is correct (changing UUID= or /dev/). You also need to chroot to the new disc and both do an grub-install and update-grub to update the boot record and /boot/grub/grub.cfg on the target.

If you need to clone at the file level, check if your old install is using UUID= or LABEL= entries in /etc/fstab and /boot/grub/grub.cfg in that case just create the filesystems on the target with the same UUID resp. LABEL (e.g. mkfs.ext4 -U ...andmkfs.ext4 -L ). If you are (still) using /dev/... entries then consider changing those, if possible, before cloning (with the risk of breaking the old system), or try to make sure the devices are the same.

Making sure grub.cfg and fstab are correct after the clone should be the mayor focus, without a bootable target system you cannot do much. The other things you need to watch out for, especially if the clone and the original are operating at the same time:

  • fixed IP addresses
  • software provided MAC addresses, resulting in DHCP request from different machines with the same MAC address
  • ssh host-keys being the same for different IP addresses (remove /etc/ssh/ssh_host_*_key* on the target).

I often found it much more easy, if moving to new hardware and I just wanted to be able to boot the old software, to install a new distribution and copy the old data to a new partition, and let the new distribution's grub2 take care of generating the appropriate grub entries. That only left doing the fstab, and no hassle of re-booting from CD (or nowadays USB) to get the target system to work if there is an /etc/fstab entry problem on the "cloned" system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.