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:
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
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).
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
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
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.