Bug 870128

Summary: improve blkid documentation
Product: Red Hat Enterprise Linux 6 Reporter: Joe Vlcek <jvlcek>
Component: util-linux-ngAssignee: Karel Zak <kzak>
Status: CLOSED ERRATA QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4CC: apevec, azelinka, psklenar
Target Milestone: rcKeywords: ManPageChange
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-21 20:44:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Joe Vlcek 2012-10-25 15:30:01 UTC
Description of problem:

On a vSphere VM, without the "-l" flag blkid returns no cdrom
device when it should according to the man page.

On the below bare-metal even when using the "-l" flag blkid doesn't
list the cdrom device.

# dmidecode
<snip>
Handle 0x0001, DMI type 1, 27 bytes
System Information
	Manufacturer: Hewlett-Packard
	Product Name: HP Z210 Workstation
	Version: Not Specified
	Serial Number: 2UA1230QGZ
	UUID: 3C8F4300-8ACF-11E0-8BB7-2C27D719FBBF
	Wake-up Type: Power Switch
	SKU Number: XM856AV
	Family: 103C_53335X G=D
</snip>


Version-Release number of selected component (if applicable):

I have seen this on RHEL6.3 and RHEL6.4


How reproducible:


Steps to Reproduce:
1.
 boot system with a cdrom
2. 
attempt to use blkid without "-l" flag to list the cdrom.
# blkid -tLABEL=CDROM -odevice


Actual results:
No output is produced

Expected results:

blkid should list the cdrom on bare-metal and vSphere without
having to specify the "-l" flag.

Without the "-l" flag blkid should, as described in the man page blkid(8),
print all of the devices that match the search parameter.

Additional info:

The device is correctly returned if the "-l" flag is used.

e.g.: 
# blkid -tLABEL=CDROM -odevice -l
/dev/sr0


However the blkid(8) man page states in the last sentence of the
description of the "-l" flag that:

             "If  this  option  is  not specified, blkid will print all of the
              devices that match the search parameter."


The "-l" flag is not needed on other platforms (e.g.: Fedora and Ubuntu)
and should behave as documented in the man page.

Comment 2 Joe Vlcek 2012-10-25 17:54:58 UTC
Some more observations:

#1)

Bare-metal seems to work OK:

It seems the reason I wasn't seeing any output on bare-metal is because
the label for the cdrom is not "CDROM" as it is on the VM. On bare-metal
the label for the cdrom is: "RHEL_6.3 x86_64 Disc 1"

What I observer on Bare-metal seem OK although the label seems a bit verbose.
What I observer on the vSphere VM seems incorrect.

On bare-metal:
--------------

# blkid /dev/cdrom 
/dev/cdrom: LABEL="RHEL_6.3 x86_64 Disc 1" TYPE="iso9660" 
# blkid -odevice -t LABEL="RHEL_6.3 x86_64 Disc 1"
/dev/cdrom
# blkid -odevice -t LABEL="RHEL_6.3 x86_64 Disc 1" -l
/dev/sr0

On vSphere VM:
--------------
# blkid -tLABEL=CDROM -odevice
# blkid -tLABEL=CDROM -odevice -l
/dev/sr0


#2) Oddly, on VM, the output seems to be correct after issuing
    blkid /dev/cdrom

On vSphere VM:
--------------
# blkid -tLABEL=CDROM -odevice
# blkid -tLABEL=CDROM -odevice -l
/dev/sr0
# blkid /dev/cdrom
/dev/cdrom: LABEL="CDROM" TYPE="iso9660" 
# blkid -tLABEL=CDROM -odevice
/dev/cdrom
# blkid -tLABEL=CDROM -odevice -l
/dev/sr0

Comment 3 RHEL Program Management 2012-12-14 08:20:51 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 4 Joe Vlcek 2012-12-14 13:58:10 UTC
Please consider addressing this for the next release.

Comment 5 Karel Zak 2012-12-20 08:46:02 UTC
The libblkid does not probe removable devices by default, these devices are not in /proc/partitions. This is expected behaviour to avoid performance issues.

If you manually specify the device name on command line (e.h. blkid /dev/cdrom) then the device is added to the /etc/blkid/blkid.tab) cache file and blkid will probe this device as well.

The command "blkid -l -t LABEL=" (or UUID=) works differently, it uses /dev/disk/by-label udev symlinks to translate the tag to device name, so it bypasses the cache as well as /proc/partitions.

Maybe it's confusing (and badly documented), but all this is expected behaviour.

We have backported new command lsblk(8) to RHEL6, you can try to use lsblk --fs if you want to have overview of the devices and labels.

Note that, the latest 3.x kernels probably list removable in the /proc/partitions.

Comment 11 errata-xmlrpc 2013-11-21 20:44:05 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-1648.html