Operation Manual
which mount points. This table may look complicated at first glance, but its layout follows a logical tabular pattern.
From left to right, the columns tell Linux the location of the device to be mounted, the directory where the device should be
accessible (the mount point), the file system type, any options required, and finally, two numbers that control whether the file
system should be dumped in the event of a system problem and whether it should be checked by the fsck (file system check)
tool.
To make the system mount the new partition automatically, first open the fstab file in nano:
sudo nano /etc/fstab
Add a new line at the bottom of the file, defining the various options required by the new partition, with tabs between each field:
/dev/mmcblk0pN [Tab]/storage[Tab] ext4[Tab] defaults[Tab] 0[Tab] 2
Remember to change N for the partition number of the new partition (see Figure 5-2). If you’re using fstab to mount external
storage devices, use the device name /dev/sdXN where X is the device letter and N is the partition number. Save the file with
CTRL + W, and then exit nano with CTRL + X. When you’re back at the terminal, reboot your system and check if /storage
is mounted automatically by typing mount. If not, double-check your new fstab entry. Remember that you need to press the
Tab key each time you come to the end of a field.
Figure 5-2: Editing fstab to automatically mount the new partition
Resizing Existing Partitions
Creating a new partition is one way to make use of a larger SD card, but it’s not the most flexible. A better method is to resize
existing partitions to make use of the free space. To do this reliably, you’ll need to unplug the Pi, remove the SD card and insert
it into a desktop or laptop through a card reader.
Automatic Resizing
The Debian Linux distribution for the Raspberry Pi comes with a tool called raspi-config, which loads when the system is
booted for the first time. It can also be loaded manually at any time by typing sudo raspi-config at the console or in a
terminal window. This tool provides an interface for many common configuration tasks, including the ability to resize the root file
system to make full use of the available space on an SD card automatically.
Using the raspi-config tool to resize the root file system can, in rare cases, result in data corruption. If you have data stored on the Pi which you
can’t afford to lose, back it up first or consider following the more reliable manual resizing instructions found later in this chapter.