Release:
Red Hat Enterprise Linux
Problem:
Using UUIDs as label to identify your filesystems.
Solution:
What
is an UUID?
A universally unique identifier (UUID)
is an identifier standard used in software construction, standardized by the
Open Software Foundation (OSF) as part of the Distributed Computing Environment
(DCE). A UUID is a 16-octet (128-bit) number. In its canonical form, a UUID is
represented by 32 hexadecimal digits, displayed in five groups separated by
hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 digits and
four hyphens). For example:
550e8400-e29b-41d4-a716-446655440000
There are
340,282,366,920,938,463,463,374,607,431,768,211,456 possible UUIDs (16 to the
32nd power or 2 to the 128th power), or ~3.4 × 1038.
UUID
in Linux
In Linux, the ext2/ext3/ext4 filesystem
also uses UUID to identify partitions. You are not at the safer side if you are
using device node names like /dev/sda1 to refer your file system in your /etc/fstab. This is due to the fact that
these device node names can change due to switching of cable or upgrading
certain packages. So instead of the device node names you may consider using
the UUID or LABELs in non-LVM systems.
Determine what is your current entry of
the /etc/fstab by using the below
command.
# grep /dev/[hsv]d /etc/fstab
/dev/sda1 /boot ext4 defaults 1 2
/dev/sda3 /data ext4 defaults 0 2
Replace the device entries which point
to the device node names like /dev/sda
with the UUID or the Label. In this session we will be considering the UUID.
You may use the blkid command for
getting the UUID of the concerned devices.
# blkid | grep sd
/dev/sda1: LABEL="/boot"
UUID="c9fdb384-19ed-4b94-b29e-23f0f566e970" TYPE="ext4"
/dev/sda3: UUID="80a27dc2-c309-4cc8-9ceb-3bb1a055cf3d"
TYPE="ext4"
Following this example, the above lines
from /etc/fstab will look like this
after being fixed:
LABEL="/boot" /boot ext4
defaults 1 2
UUID="80a27dc2-c309-4cc8-9ceb-3bb1a055cf3d" /data
ext4 defaults 0 2
Check the /etc/grub.conf for the use of device node names for non-LVM device
nodes to identify the root file system. If present, change the entry by putting
in either the label or the UUID.
Non-recommended
Entry:
# grep kernel /etc/grub.conf
kernel /vmlinuz-2.6.18-308.el5 ro root=/dev/sda2
Recommended
Entry:
kernel /vmlinuz-2.6.18-308.el5 ro root=LABEL=/
OR
kernel /vmlinuz-2.6.18-308.el5 ro root=UUID=f52529cb-a959-4a11-8d43-0e4fd8fdecd2
******************
No comments:
Post a Comment