Cloning file system: Difference between revisions
From Bradnor
No edit summary |
No edit summary |
||
| Line 15: | Line 15: | ||
::mount | ::mount | ||
:<tt>sudo mount /dev/mapper/ubuntu--vg--clone-ubuntu--lv /media/USB/ | :<tt>sudo mount /dev/sdb1 /media/USB/sdb1</tt> | ||
:<tt>sudo mount /dev/sdb2 /media/USB/sdb2</tt> | |||
:<tt>sudo mount /dev/mapper/ubuntu--vg--clone-ubuntu--lv /media/USB/sdb3</tt> | |||
;to boot from clone | |||
the principle is to change uuid of disks and modify <tt>grub.cfg</tt> files to reflect this. There appears to be a <tt>grub.cfg</tt> in both <tt>/boot/efi</tt> (which is separate VFAT partition on my system) and in <tt>/boot/grub</tt> (which is the ext4 boot partition). Note that the external disk is listed as <tt>/dev/sdb</tt> when we have booted normally. If we attempt to boot from the external disk it will be listed as <tt>/dev/sda</tt> | |||
;: to find current uuids a number of commands show them | |||
:<tt>sudo blkid</tt> | |||
::lists the physical uuids of the disks | |||
:<tt>sudo pvdisplay</tt> | |||
:<tt>sudo vgdisplay</tt> | |||
:<tt>sudo lvdisplay</tt> | |||
::will display the lvm physical and logical groups and logical volumes respectively | |||
;:modify uuid of <tt>/dev/sda1</tt> which will be mounted as <tt>/boot/efi</tt> | |||
::not sure how to do this reliably as yet - but probably doesn't matter | |||
;:modify uuid of <tt>/dev/sda2</tt> which will be mounted as <tt>/boot</tt> | |||
;:edit grub.cfg on /boot/efi | |||
:<tt>sudo emacs /boot/efi/EFI/ubuntu/grub.cfg</tt> | |||
::& change the line | |||
Revision as of 11:38, 15 February 2026
- 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
