I created some USB stick images in IMZ format with USB Image Tool. They are larger than they optimally should be because the tool apparently is filesystem-agnostic (images the drive block-by-block as, say, dd would) and there was old data left on it not part of the filesystem anmore. Is there a way to wipe the space within such an image that is empty from the point of view of the filesystem, and thus reduce the image size?
(pic unrelated)
Bump. Any ideas how to compact an IMZ image (or even an uncompressed IMG image which can then be compressed manually much better after the deleted data is wiped)?
>inb4 "wipe empty space before imagining, or restore image to USB stick, wipe empty space, and reimage"
That's both time-consuming and putting unnecessary strain on the USB stick, wasting write its write cycles. There should be a way to wipe empty space on volumes within IMG/IMZ images?
Why do you want an image, not a .RAR of the files?
>>52437358
Good question, the reason is quite simple though - they're images of bootable USB sticks, which are more or less complicated and/or time-consuming to create, such as multiboot USB sticks with various troubleshooting tools, or Linux installers created with Unetbootin (which usually take some time to create, and put strain on the USB stick as the filesystem is built). I want to archive bootable images which may be useful in the future, while optimally keeping them as compact as possible (hence the IMZ format, but old data within the raw image makes it less compressible).
>>52437358
Btw even if they weren't bootable images, it's easier and faster (potentially MUCH faster if there's a lot of small files) to reimage a USB stick block-wise that recreate a file system by copying loose files onto it file-by-file.
>>52438319
>block-wise that recreate
>*thaN
So people respond with a ton of "ideas" in bullshit threads like >>52433804, but nobody has any ideas when it comes to useful stuff like disk image handling?
>>52436665dd if=/dev/zero of=/media/myshittydrive/zero.bin
then create an image with dd and compress it with xz
NEXT.
>>52438972
This is suggesting what >>52436999 already referred to as doable, but rather clunky and convoluted. There surely must be a way to do it with an image (rather than going through the ordeal of imaging a USB stick, wiping the free space on there and then dumping another image)?
>>52439265
then mount the image on /media/myshittydrive/ faglord
or just set it up as loop device and use resize2fs to resize the partition to a smaller value.
>>52439265
there is no other way. i usually mount the image, create the zero.bin, remove zero.bin, umount image, then cp --sparse=always bloated.img sparse.img. then remove the bloated one.
unused blocks can be removed only in a filesystem-specific way. like trimming in an ssd. there is no trimming for images.
Is there a way to mount an IMZ (compressed) image directly under Windows? Imdisk/OSFmount don't seem to be able to.
Wiping empty space on a physical USB stick itself is both slow as well as unnecessarily wearing out the USB stick memory. For these reasons it seems much better to do the compacting on an already dumped image.