Disk Cloning - LeandroTheDev/arch_linux GitHub Wiki

Downloading

  • sudo pacman -S partclone

Using

In this example we will clone the disk sda into sdb2, the sda is a UEFI arch linux with three partions, 1 - EFI, 2 - linux, 3 - linux "home". To your disks use lsblk.

If you are using the system you are cloning to actually clone consider cloning the system into another partition, in this example we are cloning the system partition 2 to another partition 4

  • sudo dd if=/dev/sda2 of=/dev/sda4 bs=64K conv=noerror,sync
  • Unfurtunally you are cloning the entire block of your the system, so if your partition has 100 gb you are cloning the entire 100 gb block, consider installing the system into a much smaller size if you are doing that way

Mount a external disk or usb to store your clonation

  • mkdir /backup
  • sudo mount /dev/sdb2 /backup

Cloning the boot partition

  • sudo partclone.fat32 -c -s /dev/sda1 -o /backup/boot.img

Cloning the system partition

  • sudo partclone.ext4 -c -s /dev/sda2 -o /backup/system.img

OR, in cases you manually cloned the system in partition 4

  • sudo partclone.ext4 -c -s /dev/sda4 -o /backup/system.img

Cloning the home partition

  • sudo partclone.ext4 -c -s /dev/sda3 -o /backup/home.img

Safelly umount the usb or disk

  • sudo umount /backup