Chapter 5: Partition Management

Having the Raspberry Pi’s operating system provided as an image of somebody else’s SD card is convenient, but a little inflexible. Most distribution images available for download assume a 2 GB or 4 GB SD card, meaning that people with 8 GB or larger cards find much of their space wasted.

Creating a New Partition

One way to make the most of a large SD on the Raspberry Pi is to create a new partition in the empty space at the end of the card. This partition can be used to store any large files that you want your Pi to be able to access without having to use an external storage device.

All the tasks required for this can be carried out directly on the Pi, without having to remove the SD card and connect it to a PC. All you need is an SD card flashed with one of the Raspberry Pi Linux images (as described in Chapter 1, “Meet the Raspberry Pi”) and some free space.

warning.eps

When using tools that can modify the partitions on a disk, it’s important not to delete any existing partitions. In particular, be careful not to delete the /boot or root file system partitions, or the Pi will be unable to load.

Follow these steps to create a new partition on an SD card:

1. Open a terminal window, and type sudo fdisk -l to list the storage devices connected to the Pi and their current partitions. The SD card will appear as /dev/mmcblk0 with a series of partitions numbered ...

Get Raspberry Pi User Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.