From a13277d2908bc5510cc7dfb299b91689004d7955 Mon Sep 17 00:00:00 2001 From: Sven Vermeulen Date: Sat, 12 Feb 2011 19:24:35 +0100 Subject: [PATCH] Add LABEL/UUID information --- ChangeLog | 3 + src/linux_sea/05-linuxfs.xml | 3 +- src/linux_sea/13-storagemanagement.xml | 98 ++++++++++++++++++++++++++ src/linux_sea/15-installgentoo.xml | 15 ++-- 4 files changed, 113 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index ac2f774..aca37ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +** (2011-02-12) Sven Vermeulen + - Add information on file system UUIDs and LABELs + ** (2010-11-02) Sven Vermeulen - Switch from slocate to mlocate - Add information on Portage error where a dependency cannot diff --git a/src/linux_sea/05-linuxfs.xml b/src/linux_sea/05-linuxfs.xml index 4b04d59..729448f 100644 --- a/src/linux_sea/05-linuxfs.xml +++ b/src/linux_sea/05-linuxfs.xml @@ -497,7 +497,8 @@ brw-r----- 1 root disk 8, 8 Sep 30 18:11 /dev/sda8 - The device to mount + The device to mount (also supports labels - we'll discuss + that later) diff --git a/src/linux_sea/13-storagemanagement.xml b/src/linux_sea/13-storagemanagement.xml index f8ddc3e..d0ca351 100644 --- a/src/linux_sea/13-storagemanagement.xml +++ b/src/linux_sea/13-storagemanagement.xml @@ -505,6 +505,104 @@ is corrupt, and you might try running e2fsck with an alternate superblock: ~# e2fsck -y /dev/hda4 + +
+ Using File System Labels or IDs + + Most, if not all file systems allow you to give them an + appropriate label. Such labels can then later be used to identify a file + system without having to mount it (and look at it). Linux even supports + the use of these labels for the various mount and file system + operations. The use of labels (or UUIDs, as we will see later) also + allows one to use configurations (such as in the + fstab file) which do not need to be modified when + your system gets changed (for instance, new partitions created, new + disks added, reshuffling of disks and more). + +
+ Labels versus UUIDs + + There are two identifiers commonly used when dealing with file + systems: LABEL and UUID. + + + + a LABEL + LABEL + is a user-provided name for a file system. An + example could be "ROOT", "HOME" or "DATA". + + + + a UUID + UUID + (Universally Unique Identifier) is a + system-generated identifier for a file system. Examples are + "bae98338-ec29-4beb-aacf-107e44599b2e" and + "31f8eb0d-612b-4805-835e-0e6d8b8c5591" + + + + As you can imagine, a given label is much more user friendly + than a UUID. So, how do you set a label for a file system? Well, this + heavily depends on the file system you use. For ext2, ext3 or ext4 + file systems, you can use the e2label + e2label + command: + + ~# e2label /dev/sda2 ROOT + + For an XFS file system, the command would be given with + xfs_admin: + + ~# xfs_admin -L ROOT /dev/sda2 + + You can even set labels for swap file systems (mkswap + -L <labelname> <device>), FAT file systems + (mlabel -i <device> ::<labelname>) and + JFS file systems (jfs_tune -L <labelname> + <device>). + + The easiest method to read the label and UUID of a file system + is to use the blkid + blkid + command: + + ~# blkid /dev/sda3 +/dev/sda3: UUID="2bc32022-27a8-47d5-8d33-83c86e23618c" LABEL="ROOT" TYPE="ext4" +
+ +
+ Using Labels/UUIDs in fstab + + If you have set a label for your file system(s) (or use UUIDs) + you can use this information in the /etc/fstab + file. Just substitute the value in the first column (where the device + is located) with the correct LABEL= or UUID= setting: + + /dev/sda2 / ext4 defaults,noatime 0 0 + + could then become one of the following: + + LABEL="ROOT" / ext4 defaults,noatime 0 0 + + or + + UUID="bc32022-27a8-47d5-8d33-83c86e23618c" / ext4 defaults,noatime 0 0 +
+ +
+ (Not) Using Labels/UUIDs as Kernel Options + + Some people hope to use the same information as kernel option + (for instance, to change the root=/dev/sda2 + kernel parameter to root=LABEL=ROOT). This is + possible, but only if you use an initramfs (so use this for the + real_root= parameter). The Linux kernel itself + does not support calling devices through their UUID or LABEL + information. +
+
diff --git a/src/linux_sea/15-installgentoo.xml b/src/linux_sea/15-installgentoo.xml index 034b5b5..4aebe81 100644 --- a/src/linux_sea/15-installgentoo.xml +++ b/src/linux_sea/15-installgentoo.xml @@ -68,13 +68,16 @@ Once your environment is set up, you'll need to setup your disks by partitioning them and then putting a file system on them. Partitioning and file system management has been discussed beforehand: + linkend="hdpartitions">beforehand. If you want, assign labels to + the file systems to make it easier to create your + fstab file later: # fdisk /dev/sda (Partition the disk) -# mkfs.ext2 /dev/sda1 -# mkfs.ext3 /dev/sda2 -# mkfs.ext3 /dev/sda3 +# mkfs.ext2 -L BOOT /dev/sda1 +# mkfs.ext3 -L ROOT /dev/sda2 +# mkfs.ext3 -L HOME /dev/sda3 +# mkswap -L SWAP /dev/sda4 Once that your partitions are created and a file system is put on it, it is time to really start the Gentoo Linux installation. @@ -380,7 +383,9 @@ de_DE@euro ISO-8859-15 To start with the file system information, you need to edit the /etc/fstab file. The structure of this file has been discussed before so this shouldn't be an issue (see The mount command). + linkend="mountsection">The mount command). If you want to use + labels instead of device locations, use the + LABEL="..." syntax in the first column. /dev/sda1 /boot ext2 noauto,noatime 0 0 /dev/sda2 / ext3 defaults,noatime 0 0