Comment 4 for bug 1796788

Theodore Ts'o (tytso) wrote :

Note a file system which is significantly shrunk --- which tends to be the case with resize2fs -M --- is going to have files fragmented which will have performance implications. It's not clear to me what you are trying to optimize for --- I assume you're just wanting to save on download bandwidth so you want a highly compressed image?

You might want to consider using a raw qemu image, e.g:

     e2image -Q /dev/sda1 /tmp/sda1.qcow
     bzip /tmp/sda1.qcow # optional

which can then be unpacked via:

     bunzip /tmp/sda1.qcow.bz2
     e2image -r /dev/sda1.qcow /dev/sda1

You can of course also use qemu-img from the qemu package. e2image -Q is a bit more efficient though since it will only include blocks which are in use in the file system, where as qemu-img is not aware of the underlying file system.