Skip to content

Automatically shrink a Raspberry Pi image in order to reduce the final image size.

License

Notifications You must be signed in to change notification settings

monsieurborges/pishrink-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PiShrink dockerized

PiShrink automatically shrink a Raspberry Pi image in order to reduce the final image size.

It's great for saving disk space or sharing your Pi image on the Internet.

This project is a dockerized version of the PiShrink bash script by Drew Bonasera.

Release Docker License

Usage

  1. Make a copy of a Raspberry Pi SD card that you want to shrink (see instructions here).

  2. Using the Terminal, access the directory containing the Raspberry Pi image:

    cd ~/Directory-with-RPi-image
  3. Run PiShrink dockerized:

    docker run --privileged=true --rm \
        --volume $(pwd):/workdir \
        monsieurborges/pishrink \
        pishrink -Zv IMAGE.img NEW-IMAGE.img

PiShrink options

pishrink [-adhrsvzZ] IMAGE.img NEW-IMAGE.img

  -s         Don't expand filesystem when image is booted the first time
  -v         Be verbose
  -n         Disable automatic update checking
  -r         Use advanced filesystem repair option if the normal one fails
  -z         Compress image after shrinking with gzip
  -Z         Compress image after shrinking with xz
  -a         Compress image in parallel using multiple cores
  -d         Write debug messages in a debug log file

If you specify the NEW-IMAGE.img parameter, the script will make a copy of IMAGE.img and work off that. You will need enough space to make a full copy of the image to use that option.

Check out PiShrink GitHub for more details.

Docker Hub

Author

License

The source code is licensed under the MIT license.

The content of this project itself is licensed under the Creative Commons Attribution 4.0 International.