[colug-432] creating sparse disk images

Rick Hornsby richardjhornsby at gmail.com
Mon Nov 12 17:02:25 EST 2018


A normal RaspberryPi image from Raspian is ~1.5GB as a zip, and as far as I
can tell, around or about 4GB when expanded and burned to an SD card.

I’m having a hard time taking the SD card and creating a sparse image from
it. I think “sparse” is what I want — I burned the image to a 16GB SD card
made some changes and then tried to use dd to create an image of the
modified card, and no matter what I do I’m always ending up with a 16GB
image file. The changes I made include installing a couple of packages, a
couple of python modules, and setting up some python scripts to run as a
service on boot. Nothing major.

I’ve tried to run zerofree on the card (to ensure the free space is all
0x00), and then specifying ‘conv=sparse’ to dd but it made no difference. I
tried making the image on Linux and Mac. dd seems to be very similar on
both.

# dd if=/dev/sdc of=/tmp/sd_card.img conv=sparse

I can use gzip, and it takes 16GB down to ~1.5GB. Etcher is a really nice,
user-friendly app for making a new SD card. It’s what I’d like to recommend
to my client for making a new SD card if they need it.

Etcher takes the 1.5GB gzip, says “oh, okay, cool. I can deal with a gz’d
file. Looks like ~3GB. Give me a few minutes”. Etcher gets to 100% fairly
quickly, then stays there for a long time. It’s not, but it looks like it’s
hanging. I can only guess that Etcher is calculating that it needs to write
3GB, but is actually writing the full 16GB.

‘Disk Utility’ on the Mac has become a nearly useless piece of junk over
the last several macOS/OSX versions. It often disallows or fails on
operations more than the most simple, and it will only see the smaller
FAT32 partition of the SD card, not the ext partition.

Maybe I’m not understanding what “sparse” means in this context?

Any ideas?

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.colug.net/pipermail/colug-432/attachments/20181112/70422e9d/attachment.html 


More information about the colug-432 mailing list