Wednesday, December 15, 2010

UUID file system identification to improve /etc/fstab stability in Linux

The naming convention used in Linux such as sda/sdb/sdc etc are system chosen.
In SAN Environment, the LUN priority changes after certain operations which alters the device names detected in Linux, causing the wrong static mapping according to the /etc/fstab file or no mapping at all.
So to prevent this from happening it is good to map the mounts using the unique UUID written on every device.
Hence the device to directory mounting remains the same all the time.

The UUID's are assigned to the separate partitions i.e. sda1/2/3/4 etc.
fstab entry for example is
UUID= /media/sdb1 xfs defaults,umask=009,gid=47 0 0
Here it will get it mounted in the /media/sdb1 directory

Existing UUID can be seen by using this
ls -l /dev/disk/by-uuid/

More details can be found about the file systems using
sudo vol_id /dev/sdb1

or by using
blkid /dev/sdb1

New UUID ( Unique Identifiers ) can also be written to the Drives or LUN's detected.
To assign new uuids to the new /dev/sda-b-c-d detected
1)uuidgen
2)tune2fs -U /dev/sdc (for ex) - for ext2,3,4
3)xfs_admin -U /dev/sdc for xfs
4)reiserfstune -u /de/sdc for reiserfs

No comments:

Post a Comment