Raspberry Pi

Shrink Raspberry Pi Image Using PiShrink

PiShrink is an open-source bash script used to shrink the operating system image, which can be put back onto the Raspberry Pi SD card much faster than the original image. It benefits users who want to fit a large image onto an SD card.

This article is a brief guide to make Raspberry Pi image smaller using PiShrink.

PiShrink-Make Raspberry Pi Image Smaller

To start shrinking Raspberry Pi Image, follow the below-given steps:

Step 1: Download PiShrink Bash Script

First, download PiShrink bash script on Raspberry Pi from the following command:

$ wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh

 

Step 2: Make PiShrink File Executable

You must run the following command to make the allow Raspberry Pi users to run the PiShrink file on Raspberry Pi:

$ sudo chmod +x pishrink.sh

 

Step 3: Run PiShrink on Raspberry Pi

Now, to start shrinking the image on Raspberry Pi, you have to download a .img file on Raspberry Pi. You can also create a backup for the current Raspberry Pi OS from here.

In my case, I have an image file with the name “Pi.img” and the command to shrink the image on Raspberry Pi is given below:

$ sudo ./pishrink.sh <image_file>

 

After the execution of the above command, the image file will be compressed as in my case the file is reduced to 1.7GB from 1.8GB. After this point, you can use this image file and boot it on the SD card faster.

Conclusion

PiShrink is a bash script used to reduce the image file size on Raspberry Pi. It will speed up the process of booting the image on the SD card. You can download the script on Raspberry Pi from the “wget” command and run the script after giving the execute permission to the file using the “chmod” command. You need a “.img” file to start shrinking the image with PiShrink on the Raspberry Pi terminal.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.