I have a Raspberry Pi running an IVR application. The application is a little painful to setup. My plan is to distribute the Pi image that has everything installed with a few friends that are planning to use it.

Whats the best way to compress the image so that it's easier to distribute? So far dd seems like a possible solution. I am running the Pi on a 16 GB memory card.


You can make use of dd and gzip combined to make it compressed.

Here is an example:

sudo dd bs=4M if=/dev/mmcblk0 | gzip > </path/to/image/image-name>.gz

To make use of the same gzip image and write it to an SD card :

sudo gzip -dc </path/to/image/image-name>.gz | sudo dd bs=4M of=/dev/mmcblk0

If you're using a USB card reader, replace your device path in if or of accordingly.

Here is a reference for more details. Link

Hope it helps.

| improve this answer | |
  • 2
    Don't forget to actually remove data of old files from the filesystem, else dd will copy also these and the image will be bigger. Run dd if=/dev/zero of=/tmp_file bs=1M until the filesystem is full, then rm /tmp_file. – Marki555 Jun 29 '15 at 11:40
  • thanks for the clear answer. Hopefully, the result will be under a few gigs so that its easier to share :) – feverDream Jun 30 '15 at 3:14
  • It worked perfectly. I was able to compress the image to 4 gigs. May be I can compress it a bit more with tweaking. – feverDream Jun 30 '15 at 16:12
  • @feverDream You make use of this downsizer script : sirlagz.net/2013/03/10/script-automatic-rpi-image-downsizer to reduce size of copied SD card and then use gzip to compress it more. Worth a try. – dhruvvyas90 Jul 1 '15 at 8:11

If you use NOOBS, then there is this simple setup tool that you can access by holding shift key during startup. You could supply it with scripts to install your data. You could then restore your installation from raspberry directly without a need for another computer. But dd should be faster.

| improve this answer | |
  • That sounds like what I might need. I was thinking of asking users to manually run a script that takes care of all the things. – feverDream Jun 30 '15 at 3:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.