Clonezilla
244 Words ⏱ Reading Time 1 Minute, 6 Seconds
2024-10-22 00:58 +0000[f65b048 @ 2024-10-27]
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:
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.
Figure out how much space is actually in use:
df -hResize the filesystem close to that number (not so close that the machine is unusable from no free space)
sudo resize2fs /dev/sda3 20GResize the corresponding partition to match the new size
sudo fdisk /dev/sdaDelete partition
3in this case, and create a new partition3with the the default starting sector, and+20Gto match the above filesystem size.Note: When asked if you’d like to remove the ext4 signature, answer
NforNo.Create the clonezilla disk as usual. This allows the last partition to be grown and can often be done online.
When restoring the smaller partition, use expert mode and ensure the
-icsoption 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.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