Clonezilla


Tips

When cloning filesystems, clonezilla is good at only storing the occupied blocks of each partition’s filesystem. If you might ever need to restore to a smaller disk, spend the up front time to:

  1. Boot to a Live Disk.

    In my case an Ubuntu 22.04 LTS netboot was used. The tools were already installed and netbooting was already present.

  2. Figure out how much space is actually in use:

    df -h
    
  3. Resize the filesystem close to that number (not so close that the machine is unusable from no free space)

    sudo resize2fs /dev/sda3 20G
    
  4. Resize the corresponding partition to match the new size

    sudo fdisk /dev/sda
    

    Delete partition 3 in this case, and create a new partition 3 with the the default starting sector, and +20G to match the above filesystem size.

    Note: When asked if you’d like to remove the ext4 signature, answer N for No.

  5. Create the clonezilla disk as usual. This allows the last partition to be grown and can often be done online.

  6. When restoring the smaller partition, use expert mode and ensure the -ics option is selected which ignores that the disk is smaller than the destination disk. Assuming the partition(s) have been shrunk enough, this shouldn’t be an issue.

  7. Optionally now the partition can be grown to the size the smaller disk allows. Effectively this is just removing and re-creating the partition with the automatically suggested end partition size (end of available disk space) and calling sudo resize2fs /dev/sda3