Cloning file system
From Bradnor
- to clone file system
use dd to clone disk, e.g.
- sudo dd if=/dev/sda of=/dev/sdb bs=4M conv=noerror,sync status=progress
- to mount clone
principle is that the cloned volume needs to renamed before it can be mounted
- rename volume
- sudo vgimportclone --basevgname ubuntu-vg-clone /dev/sdd3
- activate
- sudo lvchange -a y 'ubuntu-vg-clone/ubuntu-lv'
- mount
- sudo mount /dev/sdb1 /media/USB/sdb1
- sudo mount /dev/sdb2 /media/USB/sdb2
- sudo mount /dev/mapper/ubuntu--vg--clone-ubuntu--lv /media/USB/sdb3
- to boot from clone
the principle is to change uuid of disks and modify grub.cfg files to reflect this. There appears to be a grub.cfg in both /boot/efi (which is separate VFAT partition on my system) and in /boot/grub (which is the ext4 boot partition). Note that the external disk is listed as /dev/sdb when we have booted normally. If we attempt to boot from the external disk it will be listed as /dev/sda
- to find current uuids a number of commands show them
- lists the physical uuids of the disks
- will display the lvm physical and logical groups and logical volumes respectively
- modify uuid of /dev/sda1 which will be mounted as /boot/efi
- not sure how to do this reliably as yet - but probably doesn't matter
- modify uuid of /dev/sda2 which will be mounted as /boot
- edit grub.cfg on /boot/efi
- & change the line
