LinuxBasics.org

The community that helps people to run Linux

rss
Table of Contents

UUID Naming - How to use it

Why use UUID?

Most likely you already are using it with a distro from 2007, but if you have an older version, you may be surprised when you do a kernel upgrade and it won’t boot. (Personal experience with this one!)

From man fstab:

“Instead of giving the device explicitly, one may indicate the (ext2 or xfs)filesystem that is to be mounted by its UUID or volume label (cf. e2label(8) or xfs_admin(8)), writing LABEL=<label> or UUID=<uuid>, e.g., ‘LABEL=Boot’ or ‘UUID=3e6be9de-8139-11d1-9106-a43f08d823a6’. This will make the system more robust: adding or removing a SCSI disk changes the disk device name but not the filesystem volume label.”

One notable problem is that newer kernels use scsi nomenclature for drives. If doing a kernel upgrade it is probably best to first convert fstab entries to UUID rather than /dev/hdax.

Carla Schroder’s article "Corraling Linux Hard Disk Names" gives a good explanation of this.

How to use UUID

First get the UUIDs for your partitions:

sudo vol_id /dev/sda1
ID_FS_USAGE=filesystem
ID_FS_TYPE=ext3
ID_FS_VERSION=1.0
ID_FS_UUID=75c0cddc-2794-4c91-ad70-887861f9deb3

Add to fstab like this:

# /dev/sda1
UUID=75c0cddc-2794-4c91-ad70-887861f9deb3       /       ext3    defaults,errors=remount-ro      0       1

Or to your grub menu.lst like this:

title           Ubuntu 7.10, kernel 2.6.20-16-generic
root            (hd0,0)
kernel          /boot/vmlinuz-2.6.20-16-generic root=UUID=75c0cddc-2794-4c91-ad70-887861f9deb3 ro quiet
initrd          /boot/initrd.img-2.6.20-16-generic

Copyright (c) by the authors.
Prior to editing, authors agreed to license their contributions by the terms of the GPL.
See our licensing page for details.


Linux® is a registered trademark of Linus Torvalds.


 
  tutorials/during/uuid_naming.txt · Last modified: 2008/07/20 19:08

LinuxBasics.org

Start Linux-Course Tutorials Linux Links Security Blog Forum E-mail List Search Online Chat

Site-Info

Help Get in Touch Making of LBo

Wiki-Control

Powered by

Linux Apache DokuWiki Mailman RUTE ht://Dig