Saturday, August 25, 2012

Finding the device-name associated with a file-system label

We might have came across a situation where a Device associated with a file-system label is missing and due to which we will get an error on boot-up saying file-system can't be found for the Label=[labelname]. To resolve this, we have to find the corresponding Device name associated with the file-system label (set by using the command 'e2label') and fix the problem with it by running 'fsck' or by changing the Label to other alternative disk.
'findfs' is the handy command for it; this is like a reverse case of 'e2label' command.

Below given is a self-explanatory illustration of it:

[root@linuxhost ~]# e2label /dev/sda1
/boot
[root@linuxhost ~]# e2label /dev/sda1 Test
[root@linuxhost ~]# e2label /dev/sda1
Test

[root@linuxhost ~]# findfs LABEL="Test"
/dev/sda1
[root@linuxhost ~]# 

[root@linuxhost ~]# cd /dev/disk/by-label/
[root@linuxhost ~]# ls -l
total 0
lrwxrwxrwx 1 root root 10 Aug 16 08:56 Test -> ../../sda1
[root@linuxhost ~]#

No comments:

Post a Comment