TransWikia.com

How To Create a Bootable Clone of boot disk

Ask Ubuntu Asked by TheOld Crab on February 12, 2021

In my environment I have 2 MAC Minis, a Windows10 machine, and Ubuntu 20.04 LTS. On the MAC minis, I run SuperDuper to create a bootable clone on an external hard disk. Is it possible to do the same thing on Ubuntu? I saw an earlier answer to this, but it involved many steps monkeying around with dd, /etc/fstab and grub, and is several years old. Is there a new and better way? I considered Clonezilla but it doesn’t specifically say on their web page that it will create a bootable clone. I want my solution for the Ubuntu machine to work like SuperDuper does for my MACs.

2 Answers

I run SuperDuper to create a bootable clone on an external hard disk. Is it possible to do the same thing on Ubuntu?

Although there is no tool out there like CCC (Bombich) or Super Duper for Mac OS, I think I have done it roughly, at least with EFI booting and a single user.

Introduction

(I write "disk" for any non volatile memory.)

If you make a complete clone with dd then it will take a very long time so you can't do it too often, moreover you may have trouble using both disks at the same time as they have initially the same identifiers.

You need an incremental copy program like rsync, not Clonezilla. I have never used Clonezilla but I have read elsewhere that it does not have the incremental feature so I did not search further.

Identity must be set consistently on each disk for booting.

Also, in order to copy from original to clone, at least, both should be mounted simultaneously, so they should have different identifiers (UUIDs and so on).

Technical details

Disk identity seems to lie in exactly three locations:

  1. The EFI File System = EFS, on its own FAT partition separate from Linux partition.
  2. /etc/fstab containing disk UUID.
  3. /boot, because the EFI alone is not enough to boot!

How to

On the intended clone, create a FAT partition about same size as the original EFS. Copy the EFS with cp -r or drag and drop: there are few small files and they will rarely change. Note that FAT does not know about permissions so you don't have to worry about them.

By the way, also create Linux partition(s), similar to the one(s) you want to clone (e. g. ext4), and HFS+ if you also want to clone Mac OS with CCC (or Super Duper).

Create a Ubuntu live USB, as explained elsewhere. You can use Startup Disk Creator.

Power off. Disconnect you original disk from your computer, keep it safe or else you may have a hard time to reboot from it.

Connect the intended clone in place of the original (but don't put back the screws until the clone works). Install Ubuntu on it from the Ubuntu live USB, creating one user with the same name as original.

If you have files from a previous attempt, in order to save time, choose "Something else" in the install menu and do not reformat.

The Ubuntu installer with hopefully fill correctly the EFI, fstab and boot, better than you could do it yourself.

Check that the intended clone indeed boots Ubuntu.

Power off. Disconnect the intended clone. Reconnect original. Reboot. Reconnect intended clone externally (by USB Firewire...) With Disks, check intended clone mount (to be put instead of $MOUNT). Complete the clone with

sudo rsync -aEHuvX --progress --exclude={"/etc/fstab","/export",".cache","/dev","/proc","/sys","/tmp","/run","/mnt","/media","/lost+found","/cdrom","/srv","/swapfile","/boot"} / $MOUNT

/etc/fstab /boot must be excluded to preserve clone boot-ability. Other excludes concern temporary, duplicate, auxiliary files that should not be copied because that will cost time and may cause trouble. Later, you will add -delete to save space.

Power off. Replace original by intended clone. Check reboot and clone functionality.

Defects found on the clone

  • Evolution fails : "evolution-alarm-notify crashed" and "settings schema not installed".

  • Login shell on clone is bash, whereas it was zsh on original.

  • Many Gnome desktop shortcuts don't work.

I missed something to copy correctly user database or settings.

Maybe swapping disks physically could be avoided but I am afraid to try.

Please improve.

Answered by Pierre ALBARÈDE on February 12, 2021

As for cloenzilla, check that the destination drive/partition is formatted. And then in Clonezilla choose expert mode and enable the “-icds” option. You need to also choose "Resize partitional table proportionally" option. Your external should come back if you turn off, remove cable, reboot, wait then reconect the external. Type 'lsblk' to confirm it's there.

Answered by darth_epoxy on February 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP