Tag Archives: gparted

Raspberry Pi tip: resize your sd card

When you download an image for Raspberry Pi from internet (Debian image for example), the size is quite often 2GB.

In my case I’ve always SD cards of 8GB of size. After writing the image to the SD, 6GB of space get lost.

Here’s what I did to resize my Raspberry Pi Debian system without loosing its functionality.

Prerequisites

  • a sd card with Debian for Raspberry Pi installed (or similar)
  • a pc powered by Ubuntu Linux
  • GParted installed

Identify SD card

Plug your card reader and take a look to system messages with “dmesg”:
$ dmesg
[22006.536054] usb 1-1: new high-speed USB device number 3 using ehci_hcd
[22006.736355] usb-storage 1-1:1.0: Quirks match for vid 090c pid 6000: 100000
[22006.738687] scsi15 : usb-storage 1-1:1.0
[22007.737879] scsi 15:0:0:0: Direct-Access Generic 6000 PQ: 0 ANSI: 0 CCS
[22007.739762] sd 15:0:0:0: Attached scsi generic sg3 type 0
[22007.744742] sd 15:0:0:0: [sdc] 16659456 512-byte logical blocks: (8.52 GB/7.94 GiB)
[22007.745494] sd 15:0:0:0: [sdc] Write Protect is off
[22007.745500] sd 15:0:0:0: [sdc] Mode Sense: 4b 00 00 08
[22007.746235] sd 15:0:0:0: [sdc] No Caching mode page present
[22007.746240] sd 15:0:0:0: [sdc] Assuming drive cache: write through
[22007.750365] sd 15:0:0:0: [sdc] No Caching mode page present
[22007.750372] sd 15:0:0:0: [sdc] Assuming drive cache: write through
[22007.757039] sdc: sdc1 sdc2
[22007.760977] sd 15:0:0:0: [sdc] No Caching mode page present
[22007.760984] sd 15:0:0:0: [sdc] Assuming drive cache: write through
[22007.760989] sd 15:0:0:0: [sdc] Attached SCSI removable disk

In my case the SD is /dev/sdc.

Start GParted

Choose the right device with the top right selector:

Proceed with these steps:

  1. right click on all the partitions and umount them all
  2. move the swap partition to the very end of the sd (right side of the bar)
  3. resize the ext4 partition (sdc2)
  4. commit the changes

On my pc it took 2 minutes.

You’re done.