[colug-432] creating sparse disk images

Roberto C. Sánchez roberto at connexer.com
Mon Nov 12 17:40:52 EST 2018


On Mon, Nov 12, 2018 at 07:02:25PM -0300, Rick Hornsby wrote:
>    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

It has been some time since I had to do something like this, but after
creating the image with dd, you need you use something like rsync or
qemu-img to turn the image into a proper sparse file.  I have used both
and either one should do what you need.

-- 
Roberto C. Sánchez
http://people.connexer.com/~roberto
http://www.connexer.com


More information about the colug-432 mailing list