tbar
Posts: 98
Joined: Thu Nov 24, 2011 6:10 am

How to skrink image before loading it on SD card?

Wed Jul 25, 2012 11:58 am

I've got a 512 MB SD Card and a 2 GB Raspbian image (http://www.linuxsystems.it/2012/06/rasp ... imal-image). How do I shrink the image to fit on the SD card?

I'm guessing I have to 1. load the image on a different computer, 2. shrink the filesystem using gparted, 3. create an image file and 4. load this onto the SD Card. Is this correct? If so, how do I perform the individual steps outlined?

User avatar
RaTTuS
Posts: 10531
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: How to skrink image before loading it on SD card?

Wed Jul 25, 2012 12:01 pm

how to put a quart into a pint pot?
you cannot
as it will be too big
but you could put the 1st partition on the SD card and the 2nd onto a USB stick ?
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

itimpi
Posts: 1090
Joined: Sun Sep 25, 2011 11:44 am
Location: Potters Bar, United Kingdom
Contact: Website

Re: How to skrink image before loading it on SD card?

Wed Jul 25, 2012 12:02 pm

It will not be that simple as most of the 2GB is pre-loaded with software packages.

The easiest solution would be to simply get a larger SD card. I would recommend at least 4GB if you get another card, and 8GB might be better to give room to grow..

Another possibility that might work (I have not tried it) is to start with the Raspbian installer to build a minimal image.

mikerr
Posts: 2804
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: How to skrink image before loading it on SD card?

Wed Jul 25, 2012 12:06 pm

Even 2GB deosn't have too much free space on the existing distributions,
and fills up quite quickly I find - my main SD cards for Pi use are 8GB

Problem is I have plenty of 2GB cards (and smaller) - I should get around to doing a cut down image - is there one available already ?
Android app - Raspi Card Imager - download and image SD cards - No PC required !

User avatar
Mortimer
Posts: 924
Joined: Sun Jun 10, 2012 3:57 pm

Re: How to skrink image before loading it on SD card?

Wed Jul 25, 2012 12:14 pm

Go and treat yourself to a shiny new SD-card. I would recommend going for 8GB or more, but 4GB is usable.
--------------
The purpose of a little toe is to ensure you keep your furniture in the right place.

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: How to skrink image before loading it on SD card?

Wed Jul 25, 2012 12:18 pm

mikerr wrote:Even 2GB deosn't have too much free space on the existing distributions,
and fills up quite quickly I find - my main SD cards for Pi use are 8GB

Problem is I have plenty of 2GB cards (and smaller) - I should get around to doing a cut down image - is there one available already ?
Here's the thing: Doing it "straight" is at least theoretically possibly in your case, using a 2G card. In the OP's case, however, it is not even theoretically possible, since he was talking about using a 512M card. On a 2G card, it "should" fit, but apparently some people's idea of what 2G means is not the same as other people's idea and, as a result, it sometimes doesn't fit.

Now, back to the OP's case - how to utilize a 512M card. There are, of course, two possibilities:

1) Create a cut-down image from scratch that does everything you need and is less than 512M in size. This shouldn't be inordinately difficult, but it is obviously outside the remit of a beginner help oriented forum. I.e., people here will probably not be able to help much beyond wishing you luck.

2) Split one of the "supported" images between the SD card and external USB storage. There are lots of threads on this topic - again, it's not particularly difficult, but is again outside the remit of a "total beginner" forum. FWIW, the nice thing about going this route is that you don't have to "muck up" your SD card. And by "muck up", I mean the repartitioning and changing to weird (heh heh) non-Microsoft-supported filesystems - that the usual "write the image to the card" process does (albeit under the covers and without requiring you to know/understand/execute the process).

What all this means is that all you need to do is copy files to the card; no repartitioning or filesystem changing is needed. And the nice thing about doing this is that you do get a bootable system - albeit one that will soon kernel panic - but at least you get the equivalent of a BIOS.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

james968
Posts: 29
Joined: Tue Jul 17, 2012 8:52 am

Re: How to skrink image before loading it on SD card?

Wed Jul 25, 2012 12:31 pm

The Debian Live people use a squashfs filesystem for the root directory. You could like into the debian live and how it mounts the squashfs.

(Though it probably is better, to just get a bigger SD card)

tbar
Posts: 98
Joined: Thu Nov 24, 2011 6:10 am

Re: How to skrink image before loading it on SD card?

Wed Jul 25, 2012 12:51 pm

Looking at your replies I think I forgot to mention that the image mentioned is only 109MB. The rest is empty space. It is this empty space I want to reduce before loading it onto the sdcard.

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: How to skrink image before loading it on SD card?

Wed Jul 25, 2012 12:56 pm

tbar wrote:Looking at your replies I think I forgot to mention that the image mentioned is only 109MB. The rest is empty space. It is this empty space I want to reduce before loading it onto the sdcard.
That, of course, changes everything. I think most people assumed you were using one of the "standard" images, which are, AFAIK, all 2G in size and packed as full as possible (i.e., not shrinkable).

Now, in your case, since you really only have 109M of stuff, you need to somehow reduce the size of the "container" (i.e., the partition). I'm sure there are many ways to do it - it is basically the inverse of the usual problem (expanding the partition from 2G to {whatever}).

But the most straightforward way, assuming your Linux skills are in good shape, is to make the partitions on the new card the way you want them, mount the card and the image, then do "cp -a" to copy the stuff from the mounted image to the mounted card. If you do it right, it will fit...
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

User avatar
Jim JKla
Posts: 2218
Joined: Sun Jan 29, 2012 11:15 pm
Location: Newcastle upon Tyne UK

Re: How to skrink image before loading it on SD card?

Wed Jul 25, 2012 1:06 pm

I have a pile (exageration) its a small pile of 1g cards I'm interested in doing some sort of reduced load that gives you command line and some script stuff.

When you think about it Sinclair Basic was measured in Killobyte so there has to be a way to make a nano SD version that ran say python command line without a gui.
Noob is not derogatory the noob is just the lower end of the noob--geek spectrum being a noob is just your first step towards being an uber-geek ;)

If you find a solution please post it in the wiki the forum dies too quick

User avatar
RaTTuS
Posts: 10531
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: How to skrink image before loading it on SD card?

Wed Jul 25, 2012 1:15 pm

remove and purge all X
for a start
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

mikerr
Posts: 2804
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: How to skrink image before loading it on SD card?

Wed Jul 25, 2012 7:02 pm

Jim JKla wrote:I have a pile (exageration) its a small pile of 1g cards I'm interested in doing some sort of reduced load that gives you command line and some script stuff.
There is this distro on a 1GB card, and it boots straight into X

RaspRazor:
http://www.raspberrypi.org/phpBB3/viewt ... 1&p=131652

The OP wanted to this minimal 109MB command line only image
http://www.linuxsystems.it/2012/06/rasp ... mal-image/
unfortunately the image has been done from a 2GB card - so you can't directly put that on anything less.
Android app - Raspi Card Imager - download and image SD cards - No PC required !

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: How to skrink image before loading it on SD card?

Wed Jul 25, 2012 9:07 pm

unfortunately the image has been done from a 2GB card - so you can't directly put that on anything less.
But you can - if you follow my instructions upthread.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

SirLagz
Posts: 1705
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
Contact: Website

Re: How to skrink image before loading it on SD card?

Thu Jul 26, 2012 1:42 am

http://sirlagz.net/?p=487 <-- a guide on how to resize the partitions inside the image file, except you want smaller rather than bigger.
Give me a yell if you need some help :)
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044

tbar
Posts: 98
Joined: Thu Nov 24, 2011 6:10 am

Re: How to skrink image before loading it on SD card?

Thu Jul 26, 2012 5:15 am

Joe Schmoe wrote:But the most straightforward way, assuming your Linux skills are in good shape, is to make the partitions on the new card the way you want them, mount the card and the image, then do "cp -a" to copy the stuff from the mounted image to the mounted card. If you do it right, it will fit...
This sounds doable :D I don't have a Linux PC so I will have to do it in Windows (if I can get ext2fsd to read/write the data -- http://www.ext2fsd.com) or load a Linux Live CD and work from there.

itimpi
Posts: 1090
Joined: Sun Sep 25, 2011 11:44 am
Location: Potters Bar, United Kingdom
Contact: Website

Re: How to skrink image before loading it on SD card?

Thu Jul 26, 2012 8:05 am

tbar wrote:
Joe Schmoe wrote:But the most straightforward way, assuming your Linux skills are in good shape, is to make the partitions on the new card the way you want them, mount the card and the image, then do "cp -a" to copy the stuff from the mounted image to the mounted card. If you do it right, it will fit...
This sounds doable :D I don't have a Linux PC so I will have to do it in Windows (if I can get ext2fsd to read/write the data -- http://www.ext2fsd.com) or load a Linux Live CD and work from there.
You can always download the iso image for a bootable Gparted system, or one of the Linux 'live' CDs available with most linux distributions. That gives you a way of running Linux on your PC without having to install anything to the hard disk.

Return to “Raspbian”