You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
myeisha edited this page Jan 28, 2014
·
1 revision
The process to create a clean image file from some SD card you have at hand (possibly an old image you booted, updated some packages, and then shut down again) is rather simple. You will need a small script, a directory to work in, and a little bit of time.
First, create a directory somewhere. All further work will happen inside of this directory. Place the following script inside of this directory, name it clean-image.sh, and make it executable.
This script cleans the image of residual files that might be harmful, like contents of default user home directories, log files, and configurations for various daemons running on the system that should not exist on first boot. It also clears free space of the filesystem to make compression more efficient. What it does not do, however, is clean the apt-cache, you will have to do this by hand if you want it cleaned.
Second, copy your SD card into the directory with dd, i.e. using dd if=/dev/sdc of=raspi-image.img bs=1M, if /dev/sdc is the device node for your SD card.
Third, run clean-image.sh. If you have not named your image file raspi-image.img, you will have to give the actual name of the file to the script as an argument.
The image is now ready. For distribution, you will probably want to compress it with xz or similar tools.