GUI program to create partition backup image no larger than its files?

Solution 1:

The following answer uses a TUI, not a GUI solution:

Depending on your use-case (I use it to make system back-ups) you can use CloneZilla Live. It can create:

  • sparse images,
  • compressed images of:
    • entire systems,
    • entire drives
    • simply individual partitions.

The main advantages are:

  • that it boots from:
    • external media
    • internal media
  • comes with its own OS (based on Ubuntu)
  • it can make exact cold system back-ups that are easily restored.

On top of all these goodies, it can copy MBRs as well.

If a cold system back-up is not what you're looking for, you can still use the technology that CloneZilla is based upon and that is partclone.

Solution 2:

Achieving smaller disk images is usually done by ways of not copying zero outed blocks from the initial file system in the image. The concept is called sparse space in files or puching holes in files, and your host file system has to support it. a bit command line but try this:

sudo apt-get install virt-manager qemu-utils 

And then once it's install you can use :

qemu-img convert -f raw -O raw  /dev/sdX /home/<user>/Ubuntu.img

This will create a sparse ( zeros in the file aren't written) image of your disk. where -f = format, -O output format. sdX the disk ( can use partitions as well). The program has advanced features such as snapshots and different output formats (vdi, vmdk, etc). Your place where you save the image has to support sparse files, or else the size will be just as big, since zeros in the partition will be written to disk. And to make the most of it, do run a program such as sfill or zerofree found in apt on the partition, because free space does not always mean zero space, and you want to maximize the amount of zero space on the file system.

Bonus ninja points. Since linux thinks of disks as "files", then you could also use plain cp, with the condition that your output partition where you park the file knows sparse files.

sudo cp --sparse=always /dev/sdX /home/<user>/Ubuntu.img

Which will create a raw copy by means of cp..

Examples of filesystems that support sparse : ext4, btrfs, xfs, ntfs ( ntfs-3g however might not allow sparse writes).

Examples of filesystems that do not : fat32.