Disk identification by UUID in Fedora.

2010-05-19 2 min read Gnome Linux

Yesterday I managed to delete my complete /usr directory and thus had to re-install my OS but I learned something new yesterday which I didn’t know earlier or actually never bothered to find out.br /br /All the partitions are mounted by udev using the UUID or label now. Finding the label of setting the label is easy but that was not the case with UUID (at least till you dont know how to do it). So finally I set my foot to search it. Heres some of the things that I found:br /br /bblkid/b – Gives you a list like below for all your partitions:br //dev/sda6: UUID=”8D8A-6CF1” TYPE=”vfat” LABEL=”Backup” br /So this is sufficient to modify your fstab to refer to the UUID or label instead of the drive. So whats the change in fstab. If the earlier entry looks likebr //dev/sdb6nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; /media/Bkup3nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; vfatnbsp;nbsp;nbsp; uid=500,nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 0 0br /then you can change this to :br /UUID=”8D8A-6CF1”nbsp;nbsp; /media/Bkup3nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; vfatnbsp;nbsp;nbsp; uid=500,nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 0 0br /What is the benifit:br /———————br /When you re-format your Hard Disk there is a likely possibility that the dev name could well change and thus completely changing the mount points for all your fstab entries. This is really a pain if you have 10 or more partitions like the way I have. So if you use label or UUID then they never change and your mount points remain the same.br /br /Effective use: Use autofs package to automatically mount all your partitions. Autofs mounts the package at /media/LABEL, so before you hit to start your autofs label all your disks.br /br /Other ways to find the disk labels and UUID’s:br /ls /dev/disk/by-uuid –gt; simplest way. :)br /br /Will get back to this later with more details.br /br /

comments powered by Disqus