Serial Advanced Technology Attachment
(
SATA
) port a hard
disk is plugged into, which of your USB ports an external drive is connected to, and
so on) or how you order them (in the case of virtual disks).
Managing Storage Volumes
[
224
]
Add to this the fact that removable media can be inserted or removed at any time
and you have a situation where you don't really know what name each device is
going to have at any one time. For example, your external hard drive may be named
/dev/sdb1
on your system now, but it may not be the next time you mount it if
something else you connect claims the name of
/dev/sdb1
. This is one situation in
which the concept of UUIDs comes in handy. A UUID of a device will not change if
you reorder your disks (but it will change if you reformat the volume). As stated in
Figure 9.8
, you can easily list the UUIDs of your volumes with the
blkid
command:
blkid
The output will show you the UUID of each device attached to your system, and you
can use this command any time you add new volumes to your server to list your
UUIDs. This is also the first step in adding a new volume to your
/etc/fstab
file.
While I did say that using UUIDs is not required, it's definitely recommended and
can save you from trouble later on.
Each line of an
fstab
entry is broken down into several columns, each separated by
spaces or tabs. There isn't a set number of spaces necessary to separate each column;
in most cases, spaces are only used to line up each column to make them easier to
read. However, at least one space is required.
In the first column of the example
fstab
file, we have the device identifier, which
can be the UUID or label of each device that differentiates it from the others. (You
can add a label to a device while formatting it with the
-L
argument with
mkfs
commands). In the second column, we have the location we want the device to be
mounted to. In the case of the root filesystem, this is
/
, which (as you know) is the
beginning of the Linux filesystem. The third entry in the screenshot (for
swap
) has
a mount point of
none
, which means that a mount point is not necessary for this
device. In the third column, we have the filesystem type, the first two being
ext4
, and
the third having a type of
swap
.
In the fourth column, we have a list of options for each mount separated by a
comma. In this case, we only have one option for each of the example lines. With the
root filesystem, we have an option of
errors=remount-ro
, which tells the system to
remount the filesystem
as read-only if an error occurs. Such an issue is rare but will
keep your system running in read-only mode as best it can if something goes wrong.
The
swap
partition has a single option of
sw
. There are many other options that can
be used here, so feel free to consult the man pages for a list. We will go over some of
these options in this section.
Chapter 9
Do'stlaringiz bilan baham: |