[colug-432] creating sparse disk images

Rick Hornsby richardjhornsby at gmail.com
Tue Nov 13 14:38:06 EST 2018


On November 13, 2018 at 12:33:27, Roberto C. Sánchez (roberto at connexer.com)
wrote:

You need to pass the '-s' option to ls:

-s, --size
print the allocated size of each file, in blocks


Thanks for the helpful replies, everyone. I started re-working the problem,
looking at it from the perspective of dealing with the size *before* using
dd - shrinking the filesystem using resize2fs, and then shrinking the
partition to match, rather than trying to shrink the entire card image as a
single unit. After that, then I can take an image of the shrunk SD card.

Researching the approach, I came across a super easy been-there-done-that
shell script which can take the image and shrink it appropriately for the
Pi:

https://github.com/Drewsif/PiShrink/blob/master/pishrink.sh

Bonus, this also sets up the pi to automatically expand to fill the card,
which I was also going to have to figure out how to do. He does some
interesting things in the script, especially at the end using parted and
truncate.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.colug.net/pipermail/colug-432/attachments/20181113/ff0ca333/attachment-0001.html 


More information about the colug-432 mailing list