Cloning file system: Difference between revisions
From Bradnor
No edit summary |
No edit summary |
||
| Line 34: | Line 34: | ||
;:modify uuid of <tt>/dev/sda2</tt> which will be mounted as <tt>/boot</tt> | ;:modify uuid of <tt>/dev/sda2</tt> which will be mounted as <tt>/boot</tt> | ||
:<tt>sudo uuidgen</tt> | |||
::to generate and display a new random uuid number | |||
:<tt>sudo tune2fs -U <new_uuid> /dev/sdb2</tt> | |||
::where <tt><new_uuid></tt> is the new uuid displayed earlier | |||
| Line 39: | Line 43: | ||
:<tt>sudo emacs /boot/efi/EFI/ubuntu/grub.cfg</tt> | :<tt>sudo emacs /boot/efi/EFI/ubuntu/grub.cfg</tt> | ||
::& change the line | ::& change the line | ||
:::<tt>search.fs_uuid 96b8896d-0474-48c4-9976-f71e754b7ca4 root hd0,gpt4 </tt> | |||
::and insert the new uuid generated previously | |||
Revision as of 13:33, 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
- to generate and display a new random uuid number
- where <new_uuid> is the new uuid displayed earlier
- edit grub.cfg on /boot/efi
- & change the line
- search.fs_uuid 96b8896d-0474-48c4-9976-f71e754b7ca4 root hd0,gpt4
- and insert the new uuid generated previously
