SD card image creation

Hi everyone,

the problem I am having is with my Raspberry SD card, although its really a general question about creating an image of an SD card.

all the methods to create an image I have seen, either command line or application, on MAC Linux and win all seem to to do the same thing, as one might expect.

my requirements are to produce and maintain an image of my select Raspberry Pi OS and distribute it to a small number of people.

that in its self is no issue, except I live out in the sticks of Spain and I have only a MIMAX internet connection that tops out (with wind in the right direction, literally) at 6Mb download and almost 1Mb upload.

therefore EVERY byte of image I can save in my file size is a big deal.

every method I have used to date to create the image makes that image the size of the medium it was originally created upon.

ie. 8GB card makes an 8GB image, 16GB card is a 16GB image.

there is no co-relation with the actual data on the card.

my Raspberry Pi OS is about 1.2Gb with all the things I want included.

therefore my wish is to make a file that is compatible with .img, but is only as large as the data I have in use.

any ideas out there.

thanks in advance.

mark

If your image is including the empty space on the SD card then it should be possible to compress it significantly. Then, the enduser merely decompresses it before using it.

hi robert,
yes that works fine, but uncompressed they must then use a card that is as big as the free space.

ideally I want it to be no more than 2GB uncompressed.

maybe I can manually just hack the end off the file in a hex editor!

It’s been a while since I’ve installed and expanded a RPi SD image. But I remember that the ones that they distribute are created in such a way that once they’ve been installed, they can then be expanded to suit whatever size SD card the user has. It appears that the following site gives the instructions for creating these:
http://www.aoakley.com/articles/2015-10-09-resizing-sd-images.php

Hi Robert,

thanks for the link, and taking the time, I will have a close look, but as usual its all command line, which I hate with a passion since days gone bye.

with a cursory glance that may well work if no one else can find anything simpler.

I have looked and looked for ages, maybe using the wrong search terms, or just expecting such a simple job would have already been done.

I am not using raspbian, rather a much lighter OS that does not have all the kiddy software in it, not that it matters from the process point of view.

lets see if anymore suggestions come in the next couple of days, if anyone can drag them selves of the XDC path!

I’m not happy with all of the command line stuff either. If you only have to do it once, it’s not so bad, but I assume this is something that you will have to redo occasionally as you update your project. In that case you could look at creating a batch file for all of the commands.

As this is more specific to the Pi and Raspbian OS and not Xojo, you may have better luck on a rPi specific forum.

hi robert,
I have asked questions on several pi forums before, mmm maybe the 20 or so times I asked questions all attracted the same bunch of people, I have given up asking and will find out myself, managed to solve 19 of those issues, just this one to go.

last resort is to ask where at least people know which way up the keyboard goes, not last resort, only resort…

as far as the number of times I have to modify the image, I am not sure actually.

when I have the image I will put it on a 2GB card and use it as my master, changes will be on that image and then I will just make a new image of it that will only be 2GB maximum ever.

thats the plan anyway, next step is to find some one who wants to donate a 2GB SD card as I can’t seem to buy one anywhere now, I managed to get a 4gb one the other day in an AlCampo supermarket of all places, but elsewhere I only see 8GB as the base size!

I do have CCC cloner which I vaguely remember some post saying might have advanced manipulation tools, but they are not immediately visible, onward and upward.

If Raspbian were an option, the command ‘sudo raspi-config’ can expand the file system in seconds.
Doesn’t something similar exists for other linux distros?

Found a script that says it can “shrink an image of unwanted free space”. I have not tested it.
https://github.com/ShorTie8/Image_Shrinker

Hi Albin,

Raspian is no option, its distribution package is full of un-required packages that make it a very large SD footprint.
The one I am using is DietPi, and they do exactly the opposite of raspian by making an absolutely small footprint that you add anything required to, its not even got a desktop by default.
The end result for me is a full desktop image in 1.2GB which is about 1/6th of a raspbian standard image.
Their website is something of a marvel, but worth ignoring.

as I was writing this you came up with the github link above, I will try it out, after getting some sleep!

thanks for the time.