Danielya
Posts: 15
Joined: Thu May 04, 2017 12:25 pm

How to reduce Raspberian image size?

Wed May 10, 2017 11:19 am

Hello everyone,
I have one SD card with the Raspberian image which I use on one board, and I would like to duplicate it in order to put it on more SD cards and use it on more boards.
In order to do so, I've used a Windows tool called "Win32 disk imager" to read the SD card into an .img file, and then to write that .img file to the other SD card.

My issue is that not all SD cards (even if all of them is, say, 16GB) have the same usable capacity. The SD card which I used to make the img file has 14.9GB usable capacity, hence the image file is 14.9GB in size, so when I try to write that img on another SD cards, some of them fail since they have less usable capacity (14.3, 14.8, 14.1 and more..).

Is there any way to reduce the original image size, and still maintain all the functionality, so I'll be able to write the image in various SD cards?

Thanks in advance.

fruitoftheloom
Posts: 22080
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: How to reduce Raspberian image size?

Wed May 10, 2017 11:24 am

Danielya wrote:Hello everyone,
I have one SD card with the Raspberian image which I use on one board, and I would like to duplicate it in order to put it on more SD cards and use it on more boards.
In order to do so, I've used a Windows tool called "Win32 disk imager" to read the SD card into an .img file, and then to write that .img file to the other SD card.

My issue is that not all SD cards (even if all of them is, say, 16GB) have the same usable capacity. The SD card which I used to make the img file has 14.9GB usable capacity, hence the image file is 14.9GB in size, so when I try to write that img on another SD cards, some of them fail since they have less usable capacity (14.3, 14.8, 14.1 and more..).

Is there any way to reduce the original image size, and still maintain all the functionality, so I'll be able to write the image in various SD cards?

Thanks in advance.
Raspbian Jessie includes PiClone SD Card Copier which copies to a SD Card in a USB SDHC Card Reader on the RPi.

No need for Windows whatsoever....

It was included a year ago:

https://www.raspberrypi.org/blog/anothe ... -raspbian/
Last edited by fruitoftheloom on Wed May 10, 2017 11:28 am, edited 1 time in total.
Retired disgracefully.....
......to an uncomplicated life !

Rather than negativity think outside the box !

Danielya
Posts: 15
Joined: Thu May 04, 2017 12:25 pm

Re: How to reduce Raspberian image size?

Wed May 10, 2017 11:26 am

Hi,
Thanks for the fast reply.

Can you please elaborate more about how to use that copier?
Thanks.

fruitoftheloom
Posts: 22080
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: How to reduce Raspberian image size?

Wed May 10, 2017 11:29 am

Danielya wrote:Hi,
Thanks for the fast reply.

Can you please elaborate more about how to use that copier?
Thanks.
See the link I added to my response ;)
Retired disgracefully.....
......to an uncomplicated life !

Rather than negativity think outside the box !

Danielya
Posts: 15
Joined: Thu May 04, 2017 12:25 pm

Re: How to reduce Raspberian image size?

Wed May 10, 2017 11:33 am

Thanks a lot :)

Danielya
Posts: 15
Joined: Thu May 04, 2017 12:25 pm

Re: How to reduce Raspberian image size?

Wed May 10, 2017 11:37 am

fruitoftheloom wrote:
Danielya wrote:Hello everyone,
I have one SD card with the Raspberian image which I use on one board, and I would like to duplicate it in order to put it on more SD cards and use it on more boards.
In order to do so, I've used a Windows tool called "Win32 disk imager" to read the SD card into an .img file, and then to write that .img file to the other SD card.

My issue is that not all SD cards (even if all of them is, say, 16GB) have the same usable capacity. The SD card which I used to make the img file has 14.9GB usable capacity, hence the image file is 14.9GB in size, so when I try to write that img on another SD cards, some of them fail since they have less usable capacity (14.3, 14.8, 14.1 and more..).

Is there any way to reduce the original image size, and still maintain all the functionality, so I'll be able to write the image in various SD cards?

Thanks in advance.
Raspbian Jessie includes PiClone SD Card Copier which copies to a SD Card in a USB SDHC Card Reader on the RPi.

No need for Windows whatsoever....

It was included a year ago:

https://www.raspberrypi.org/blog/anothe ... -raspbian/
Another question - is there a way to activate piclone without a display?

fruitoftheloom
Posts: 22080
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: How to reduce Raspberian image size?

Wed May 10, 2017 12:07 pm

Danielya wrote:Another question - is there a way to activate piclone without a display?
It is a GUI Program.

Maybe take a look a rpi-clone: https://github.com/billw2/rpi-clone
Retired disgracefully.....
......to an uncomplicated life !

Rather than negativity think outside the box !

User avatar
DougieLawson
Posts: 37742
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to reduce Raspberian image size?

Thu May 11, 2017 6:46 am

Danielya wrote: Another question - is there a way to activate piclone without a display?
It should work on a RealVNC session. There's no command line version.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

audstanley
Posts: 10
Joined: Fri Nov 28, 2014 12:44 am

Re: How to reduce Raspberian image size?

Tue Jan 02, 2018 4:40 am

Hi everyone.

I wrote a script to simplify the process if you are shrinking a raspberry pi image from a Linux based machine. I tried a shell script on github, and it didn't seem to truncate the image properly. So I wrote a python script works great. The python script will also install needed dependencies. All you need to do is make note of ONE number from gparted once the script launches the gparted GUI. Open an issue on github if you have any or feel free to contribute.

Enjoy ;) :
https://github.com/audstanley/RaspberryPiShrink

Return to “Beginners”