«

»

Jun 21

Resize Raspberry Pi Partitions



Sandisk 16GB SD Card

Sandisk 16GB SD Card

If you downloaded the default Debian image for your Raspberry Pi and burnt it to an SD card bigger than 2GB, chances are you won’t be using the full capacity of your storage card.

The default image creates a small boot area (about 75mb), a root partition a bit smaller than 2GB and a 200mb swap space.

Soon after installing a few packages on my Pi, I ran into strange issues like log files not being created, files not downloading, etc. I started noticing errors like “No space left on device”. Using the command:

 

df -h

i could see that my SD card was completely full.

Here is an easy method to resize your Raspberry Pi’s storage card to utilise all of that wasted space.

What you need:

  • A Linux computer
  • A Raspberry Pi
  • An SD card reader/writer
  • GParted – Gnome Partition Editor

Install GParted

You should be able to find GParted in your default package manager. For Fedora/RedHat based systems use yum:

yum install gparted

For Ubuntu/Debian systems:

apt-get install gparted

Re-partition your SD card

This is the dangerous section. ALWAYS make sure you have a full backup of anything important or you may find yourself re-creating your Raspberry Pi card again.

That said, Fire up GParted and select your SD card in the dropdown (top right).

Select your SD card

Select your SD card

Next, select the linux-swap partition, we are going to move this to the end of the volume. Select Partition -> Resize/Move

Copy the value from “Free space after” to “Free space before” and press Resize/Move

(before) Move swap partition

(before) Move swap partition

(after) Move swap partition

(after) Move swap partition

 

 

 

 

 

 

 

Next, select the big ext4 partition and bring up the Resize/Move window. Change the “Free space before/after” both to 0 (zero) and press Resize/Move

(before) resize root partition

(before) resize root partition

(after) resize root partition

(after) resize root partition

 

 

 

 

 

 

 

Make sure your partition scheme looks something like the following image and when you are happy with it, press the green tick to start the process. This takes about 5-10 minutes depending on the size of your SD card and then you are free to put the SD card back in the Raspberry Pi and make sure it boots.

All done!

Final SD card partitioning

Final SD card partitioning

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>