Bug 1287611

Summary: blkid doesn't recognize biosboot partition
Product: Red Hat Enterprise Linux 7 Reporter: Alexander Todorov <atodorov>
Component: util-linuxAssignee: Karel Zak <kzak>
Status: CLOSED WONTFIX QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1287613 (view as bug list) Environment:
Last Closed: 2015-12-03 12:30:47 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 Alexander Todorov 2015-12-02 12:57:44 UTC
Description of problem:

I have /dev/sda1 which is a so called biosboot partition and blkid only shows the UUID for it:

# blkid /dev/sda1
/dev/sda1: PARTUUID="990fa6f6-634a-4097-ab48-4215b1a74ffc" 


# parted -l 
Model: ATA WDC WD1002FAEX-0 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: pmbr_boot

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  2097kB  1049kB                     bios_grub
 2      2097kB  526MB   524MB   xfs
 3      526MB   1000GB  1000GB                     lvm


... skip ...

# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt


#         Start          End    Size  Type            Name
 1         2048         4095      1M  BIOS boot parti 
 2         4096      1028095    500M  Microsoft basic 
 3      1028096   1953523711    931G  Linux LVM       


Version-Release number of selected component (if applicable):
util-linux-2.23.2-26.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Install a non UEFI x86_64 system with gpt on the kernel command line during install.
2. Selected automatic partitioning.
3.

Actual results:
blkid doesn't give us any indication that sda1 is a biosboot partition.

Expected results:
The opposite. 

Additional info:

I'm working on a test which uses blkid output and this is a corner case which isn't covered. blkid is very handy in bash scripts and we need it to somehow identify biosboot partitions.

Comment 1 Karel Zak 2015-12-03 12:24:42 UTC
*** Bug 1287613 has been marked as a duplicate of this bug. ***

Comment 2 Karel Zak 2015-12-03 12:30:47 UTC
It depends what are you looking for, I guess (also according to bug #128761) you want to check partition type. GPT uses GUIDs:

"Partition type GUIDs" at https://en.wikipedia.org/wiki/GUID_Partition_Table 

blkid provides this by

 blkid -p -o udev /dev/sda1

as ID_PART_ENTRY_TYPE= variable, but this is expensive root-only method (it probes for many another things). It's better to reuse information already gathered in udev db,

 lsblk -n -o PARTTYPE /dev/sda1

or if you really want to read the data directly from the device (system without udev, etc.) than use:

 partx -g -o TYPE /dev/sda1

but recommended is lsblk.


Note that GPT also uses special flags for mark partition as LegacyBIOSBootable (in your parted output), this is provided by blkid as ID_PART_ENTRY_FLAGS=, by partx as FLAGS and by lsblk as PARTFLAGS, in all cases as hex

$ lsblk -n -o PARTFLAGS /dev/sdc1
0x4

Note the same variable is used for MBR flags.

See wikipedia about GPT, section "Partition attributes".

on fedora (>=f22) you can use fdisk/sfdisk to translate the flag to human readable string:

# sfdisk --part-attrs /dev/sdc 1
LegacyBIOSBootable

... note that I don't plan extend libblkid to translate the flags (so WONTFIX, sorry).