Is it possible to compress an image file?

Asked by Mike on 2017-07-18

When creating an image in Win32DiskImager, the resulting image can only be written to media of the same size or larger. I've seen image files where they are compressed, and even though the source drive the image was created on is larger, the image can be written to smaller media as long as there is enough space. This is because most of the original disk was free.

Is this possible with Win32DiskImager images?

Question information

Language:
English Edit question
Status:
Answered
For:
Image Writer Edit question
Assignee:
No assignee Edit question
Last query:
2017-07-18
Last reply:
2017-07-18
Tobin Davis (gruemaster) said : #1

It is not possible to compress an image with Win32DiskImager at this time. We will be working on that for the next release (hopefully). There are a lot of suggestions on how to do this, mostly involving extra libraries, etc. We want to keep the code base small and ideally keep it within the QT framework for easier debugging/development.

A few tips that can help:
1. Shrink filesystems on your source device to as small as possible within the device OS (ex: resize2fs -M /dev/sda1).
2. Shrink the partitions to the size of the filesystem (ex: parted /dev/sda1 resize 1 <size of FS>)
3. Check the 'Read Only Allocated Partitions' option in Win32DiskImager

This will create an img file that is only the size of the used space on the device. For example, if you have a 32G SD on a Raspberry Pi, but are only using 1G for the filesystem, this will shrink the image down to ~1-2G max.

There is no easy way for me to add the ability to autoresize filesystems to the program without extensive work and understanding of all of the different filesystems used by all of the developers of my tool. Therefore I leave it to the user to figure out how to resize the filesystems for their devices.

Can you help with this problem?

Provide an answer of your own, or ask Mike for more information if necessary.

To post a message you must log in.