Day 2 - Enlarge partition

Submitted by matthiaslink on Fri, 2013-01-25 - 22:05

When booting up the first time your device and you'll check your partition with

df -h

you will recognize that your image is only around 2 gig. So we really want to use all the space that we have on our SD-card, isn't it?

Actually there are different methods described around and discussed with different agruments but I prefer

  • having one main partition without sub partitions
  • adding an swap partition at the end of the device

Resizing online with a booted arch linux on your Raspberry PI is not that easy (i used to destroy my hole work with my first try) but it's possible the follwing way without installing additional packages:

  • Start fdisk
  • Write down your start sector of your root partition
  • Delete(!) your partition on your SD-card (do only if root partition is last partition on SD-card)
  • Generate a new partition with your planned size
  • Save and exit fdisk
  • Reboot your device (e.g. shutdown -r now)
  • Resize file system of the root partition with resize2fs
  • Start fdisk
  • Generate the swap partition behind the root partition and fill up the SD-card with that if u want (i took the old recommendation of twice main memory => 1024KB for Raspberry)
  • Save and exit fdisk
  • Make swap-partition ready for use (e.g. mkswap /dev/mmblk0p3)
  • Activate swap-partition (swapon)
  • In case of no errors do update the /etc/fstab (add e.g. /dev/mmblk0p3     none     swap     pri=1     0     0)
  • Reboot your device (e.g. shutdown -r now)
  • Check if all things work right (e.g. df -h)

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.