Memory Card Block Optimization

Asked by David Gray

I'm currently using a 256MB MicroSD with only 160MB of allocated data (as shown w/unix command "df").

When creating an image with Win32 Image Writer, and checking the box for "Read Only Allocated Partitions", my image size is still 256MB. I'm guessing that means some of my data is hanging out in a latter block - if I understand how this works... (please correct me if I'm in error).


Is it possible to manipulate data on the MicroSD Card such that when I create an image, it will be closer to the size of allocated data?


Question information

English Edit question
Image Writer Edit question
No assignee Edit question
Solved by:
Tobin Davis
Last query:
Last reply:
Revision history for this message
Best Tobin Davis (gruemaster) said :

Excellent question.

Unfortunately, Win32DiskImager only looks at the partition table, and has no understanding of the underlying filesystem. So if you wanted to save an image of only the used portion, you would have to run something like resize2fs on a Linux system to shrink the filesystem, then remake the partition table to only encompass the shrunk filesystem.

Adding functionality to Win32DiskImager to resize partitions to used space would be incredibly difficult. Not impossible, but we just do not have the resources to take that large of a feature into consideration. To do so, we would have to create functions for each of the filesystems supported by most OSs. Even if we only handled the most common across the 3 most popular OSs, that would be ~8 filesystems minimum. At that point, you may as well reboot into a live Clonezilla OS image and use that.

Revision history for this message
David Gray (roslof) said :

Thanks for the quick response, Tobin. Yes, I agree that it wouldn't make sense to add that functionality. Great app as-is, and with your advice above, I think I have a solution that will work.