You need to create a bootable live disk to clone your disk. You can not copy a partition that is mounted. If you do not have internet access, use gparted. Otherwise, it might be better to use your operating systems live installer, such as Manjaro. We can download gparted and still have things like a web browser incase we get stuck. We will be using the Manjaro live disk for this guide.
- Download Manjaro.
- Insert USB disk.
- Open "Disks" application.
- Select your USB Disk in the left pane.
- Click the right options menu in the window title bar (Drive Options), and select "Restore Disk Image...)
- Select the disk image (.iso) file you previously downloaded.
Enter your bios and force boot into your live disk.
- Open the terminal.
sudo pacman -Syu dosfstools mtools gparted
.
- Open the terminal.
sudo fdisk -l
- Within the terminal output, find the disk you wish to clone and remember the disklabel type. This is most likely gpt.
- Open gparted.
- Select target disk.
- Device > Create Partition Table... > disklabel type
The target disk must be the same size or larger than the disk you wish to clone. If it is not, you need to resize your partitions.
- Open gparted.
- Select clone disk.
- Select your boot partition.
- Partition > copy.
- Take note of the unallocated space preceeding the partition, filesystem size, and flags.
- Select target disk.
- Partition > paste.
- Enter free space preceeding and new size.
- Partition > manage flags > select same flags as clone disk.
- Repeat for all other partitions.
- Select your root partition.
- Partition > resize.
- Use slider to expand it to the rest of the disk.
- Click the checkmark to start the process of cloning the disk.
The new disk is a clone of the previous disk. If you keep the old disk installed, this will cause issues as the UUID of each disk is the same.
- Open terminal
- Generate a random serial number for boot partition (fat32),
sudo mkdosfs -i /dev/[partition 1]
. - Generate a random serial number for root partition (ext),
sudo tune2fs -U random /dev/[partition 2]
.
- Open gparted.
- Select target disk.
- Select your boot partition.
- Partition > Information > Take note of UUID.
- Select your root partition.
- Partition > Information > Take note of UUID.
- Open Disks.
- Select your target disk in the left pane.
- Select your root partition.
- Click the plus symbol to mount the disk.
- Take note of the location the partition is mounted at.
- Open Terminal.
sudo gedit /mnt/[your mounted partition]/etc/fstab
- Replace the UUID's of your boot and root partition with the new values.
- Save file, ctrl + s.
- Open Terminal.
sudo gedit /mnt/[your mounted partition]/boot/grub/grub.cfg
- Replace the UUID's of your boot and root partition with the new values. Use find and replace.
- Save file, ctrl + s.
- Open Terminal.
sudo update-grub
ref
You should now be able to reboot, enter bios, and change your boot disk to your new disk. Test the computer for a while before using Disks or gparted to wipe out the clone disk.
Could you update the instruction to include updating systemd boot, please and thank you?