You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The command e2fsck -E discard $device does not seem to discard the free space. Even e2fsck -f -y -D -E discard $device does not work.
On contrary, the zerofree of dd if=/dev/zero of=zerofile;sync;sync;rm zerofile works just fine. One can also zero the first FAT partition, to decrease the image size. Then dd has to be used.
One can probably also use fstrim on the mounted image, but I'm not sure if it does not depend on the trimability of the system storage.
There is also a possibility to create a sparse file at the end, if you are not compressing it by fallocate -d image
In order to get smaller compressed image, place allocated by deleted files shall be zeroed. This is called “sparse image”. According to https://ext4.wiki.kernel.org/index.php/Ext4_VM_Images#Good_Tools_for_Making_Sparse_Images:_fstrim.2Fe2fsck.2Fzerofree to create a sparse image one has to call
e2fsck -E discard $loopback
.• Call
e2fsck -E discard $loopback
on the resulting image.The text was updated successfully, but these errors were encountered: