Hardware Reference
In-Depth Information
You'll also need to allow all members of the group to write to the directory. To do this, you
use the
chmod
command with the option
g+w
, which tells
chmod
to allow write access from
the group:
sudo chmod -R g+w /storage
he new partition is now ready for use, but there's still one more task to carry out. At pres-
ent, the partition needs to be manually mounted (using the
mount
command combined with
the
sudo
command for running as the
root
user) each time the Pi reboots. To save time, you
can tell the Pi to automatically mount the new partition instead by editing the
fstab
ile.
Short for
ile system table,
the
fstab
ile—located in the
/etc
directory—tells Linux what
ile systems should be mounted on which mount points. his table may look complicated at
irst 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 direc-
tory where the device should be accessible (the mount point), the ile system type, any
options required, and inally, two numbers that control whether the ile system should be
dumped
in the event of a system problem and whether it should be checked by the
fsck
(ile
system check) tool.
To make the system mount the new partition automatically, irst open the
fstab
ile in
nano
:
sudo nano /etc/fstab
Add a new line at the bottom of the ile, deining the various options required by the new
partition, with tabs between each ield:
/dev/mmcblk0p
N [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/sd
XN
where
X
is the device letter and
N
is the partition number. Save the ile 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 ield.