[CentOS-devel] Re: xfs volume can not be mounted with uuid or label, only scsi device name /dev/sdb

Wed Oct 8 10:39:25 UTC 2008
James Pearson <james-p at moving-picture.com>

Brandon Davidson wrote:
> Hugo van der Kooij wrote:
> 
>> John Shen wrote:
>>
>>> That was how I got the LABEL and UUID:
>>>
>>> [root ~]# /usr/sbin/xfs_admin -lu /dev/sdb
>>> label = "/mysql2"
>>> UUID = 2560a02a-239b-4ac5-affe-cf71f8e87150
>>
>>
>> /dev/sdb is the whole bleeding disk. Did you add partitions to it? Then
>> one would expect something like /dev/sdb1 instead.
> 
> 
> Good catch, Hugo!
> 
> The mount(8) man page says:
>        -L label
>               Mount the partition that has the specified label.
>        -U uuid
>               Mount  the partition that has the specified uuid.  These 
> two options require the file /proc/partitions (present since Linux 
> 2.1.116) to exist.
> 
> This would indicate that filesystem label detection only works on 
> partitions, not raw devices. John - try actually creating a partition 
> table on this disk, and then put your filesystem on /dev/sdb1. I am 
> guessing that you will find that detection magically starts working 
> after you do that.

Works fine for me:

# xfs_admin -lu /dev/sdb
label = "/test"
UUID = 9aa81fbd-3f6d-4d3d-a40f-2a5483f8fe5c
# mount LABEL=/test /mnt/tmp
# df /mnt/tmp
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sdb                 11584        64     11520   1% /mnt/tmp
# mount | grep /mnt/tmp
/dev/sdb on /mnt/tmp type xfs (rw)
# umount /mnt/tmp
# mount UUID=9aa81fbd-3f6d-4d3d-a40f-2a5483f8fe5c /mnt/tmp
# df /mnt/tmp
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sdb                 11584        64     11520   1% /mnt/tmp
# mount | grep /mnt/tmp
/dev/sdb on /mnt/tmp type xfs (rw)

i.e. the above is an XFS file system on the whole of /dev/sdb - which I 
can mount fine via its LABEL or UUID ...

However, it appears that this only works if there is an entry for this 
file system in /etc/blkid/blkid.tab (that mount creates/updates)

If I umount the file system, and then remove the line for /dev/sdb in 
/etc/blkid/blkid.tab - I then can't mount by LABEL or UUID - unless I 
previously mount by device ...

This appears to be the case for ext3 as well as xfs ...

Using a partition, then all works as expected.

James Pearson