* unclear udev format output of blkid
[not found] <5f2c4b72-cda0-4618-ae7c-b89333c1d2b9@zmail01.collab.prod.int.phx2.redhat.com>
@ 2012-03-02 11:18 ` Balamurugan Arumugam
2012-03-02 12:16 ` Thomas Bächler
2012-03-02 13:24 ` Karel Zak
0 siblings, 2 replies; 4+ messages in thread
From: Balamurugan Arumugam @ 2012-03-02 11:18 UTC (permalink / raw)
To: util-linux
Hi list,
We are trying to parse blkid output in python for all devices and their attributes.
I found two strange things.
1. udev format output is grouped by empty newline, but I see an extra newline in between.
Below is the example,
[root@fedora-16-test ~]# blkid -c /dev/null -o full
/dev/vda2: LABEL="_Fedora-16-x86_6" UUID="8c82103c-23e0-4a86-acd0-5cbe43a91801" TYPE="ext4"
/dev/vda3: UUID="3c718e5e-8298-4c41-a761-dbed215cbac3" TYPE="swap"
/dev/vdb: UUID="ywykAs-XOFv-V2OJ-VeMU-3t2Q-kO5o-hyrzE8" TYPE="LVM2_member"
/dev/vdc: UUID="NzeO60-5FJI-E6GS-ZRos-UbLX-8Aus-35QZMB" TYPE="LVM2_member"
/dev/mapper/vg00-movies-real: UUID="a0c10d12-1861-42c5-a84a-bf370d554120" TYPE="ext4"
/dev/vdd: LABEL="brick: /data" UUID="98ef6251-fa20-4439-936e-19e299ee5d49" SEC_TYPE="ext2" TYPE="ext3"
/dev/mapper/vg00-movies: UUID="a0c10d12-1861-42c5-a84a-bf370d554120" TYPE="ext4"
/dev/mapper/vg00-0--snap--movies-cow: TYPE="DM_snapshot_cow"
/dev/mapper/vg00-0--snap--movies: UUID="a0c10d12-1861-42c5-a84a-bf370d554120" TYPE="ext4"
[root@fedora-16-test ~]#
[root@fedora-16-test ~]# blkid -c /dev/null -o udev
ID_FS_LABEL=_Fedora-16-x86_6
ID_FS_LABEL_ENC=_Fedora-16-x86_6
ID_FS_UUID=8c82103c-23e0-4a86-acd0-5cbe43a91801
ID_FS_UUID_ENC=8c82103c-23e0-4a86-acd0-5cbe43a91801
ID_FS_TYPE=ext4
ID_FS_UUID=3c718e5e-8298-4c41-a761-dbed215cbac3
ID_FS_UUID_ENC=3c718e5e-8298-4c41-a761-dbed215cbac3
ID_FS_TYPE=swap
ID_FS_UUID=ywykAs-XOFv-V2OJ-VeMU-3t2Q-kO5o-hyrzE8
ID_FS_UUID_ENC=ywykAs-XOFv-V2OJ-VeMU-3t2Q-kO5o-hyrzE8
ID_FS_TYPE=LVM2_member
ID_FS_UUID=NzeO60-5FJI-E6GS-ZRos-UbLX-8Aus-35QZMB
ID_FS_UUID_ENC=NzeO60-5FJI-E6GS-ZRos-UbLX-8Aus-35QZMB
ID_FS_TYPE=LVM2_member
ID_FS_UUID=a0c10d12-1861-42c5-a84a-bf370d554120
ID_FS_UUID_ENC=a0c10d12-1861-42c5-a84a-bf370d554120
ID_FS_TYPE=ext4
ID_FS_LABEL=brick:_/data
ID_FS_LABEL_ENC=brick:\x20\x2fdata
ID_FS_UUID=98ef6251-fa20-4439-936e-19e299ee5d49
ID_FS_UUID_ENC=98ef6251-fa20-4439-936e-19e299ee5d49
ID_FS_SEC_TYPE=ext2
ID_FS_TYPE=ext3
ID_FS_UUID=a0c10d12-1861-42c5-a84a-bf370d554120
ID_FS_UUID_ENC=a0c10d12-1861-42c5-a84a-bf370d554120
ID_FS_TYPE=ext4
ID_FS_TYPE=DM_snapshot_cow
ID_FS_UUID=a0c10d12-1861-42c5-a84a-bf370d554120
ID_FS_UUID_ENC=a0c10d12-1861-42c5-a84a-bf370d554120
ID_FS_TYPE=ext4
[root@fedora-16-test ~]#
You can see last few lines are having confusing information.
Is it known issue?
2. In udev format output for all devices, there is no devname displayed. Without devname, its unclear grouping. Is there a plan to add devname in udev format output?
I tried the above in util-linux from fedora 16 and git source build.
Thanks in advance,
Regards,
Bala
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: unclear udev format output of blkid
2012-03-02 11:18 ` unclear udev format output of blkid Balamurugan Arumugam
@ 2012-03-02 12:16 ` Thomas Bächler
2012-03-02 13:24 ` Karel Zak
1 sibling, 0 replies; 4+ messages in thread
From: Thomas Bächler @ 2012-03-02 12:16 UTC (permalink / raw)
To: util-linux
Am 02.03.2012 12:18, schrieb Balamurugan Arumugam:
> We are trying to parse blkid output in python for all devices and their attributes.
This sounds like a bad idea. Instead, you should write a python
extension using the Python C API that uses libblkid directly (unless you
plan to support other implementations than CPython).
> I found two strange things.
> 1. udev format output is grouped by empty newline, but I see an extra newline in between.
'udev' output format is deprecated and will be removed in a future
version of util-linux. Starting to support it now is a clear waste of time.
> 2. In udev format output for all devices, there is no devname displayed. Without devname, its unclear grouping. Is there a plan to add devname in udev format output?
For above reasons, unlikely.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: unclear udev format output of blkid
2012-03-02 11:18 ` unclear udev format output of blkid Balamurugan Arumugam
2012-03-02 12:16 ` Thomas Bächler
@ 2012-03-02 13:24 ` Karel Zak
2012-03-03 3:28 ` Balamurugan Arumugam
1 sibling, 1 reply; 4+ messages in thread
From: Karel Zak @ 2012-03-02 13:24 UTC (permalink / raw)
To: Balamurugan Arumugam; +Cc: util-linux
On Fri, Mar 02, 2012 at 06:18:13AM -0500, Balamurugan Arumugam wrote:
> We are trying to parse blkid output in python for all devices and their attributes.
Why? Maybe we can help you...
Do you know that udev db already contains all the attributes? Try:
udevadm info --export-db
See also lsblk --help, it returns many information about block devices.
> I found two strange things.
> 1. udev format output is grouped by empty newline, but I see an extra newline in between.
> Below is the example,
See Thomas's response, this output format is deprecated. Use "-o export".
Unfortunately, the "export" format does not contain devname too. This
problem should be fixed in git tree now. (Thanks for bug report.)
> [root@fedora-16-test ~]# blkid -c /dev/null -o udev
The command blkid without '-p' returns only small subset of all
available attributes. The command blkid was originally designed
for LABEL/UUID conversion to devname. The cache (high-level API of
the library) does not contain more information.
I'd like to remove the cache from blkid command and use the low-level
(-p) by default one day. The cache is confusing for many people...
My suggestion is to read the information from udev db (you can use
libudev too) or use something like:
for x in $(lsblk --output KNAME); do
blkid -p -o export /dev/$x
echo
done
I hope that one day the for() will be unnecessary and blkid without
-p will return all information.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: unclear udev format output of blkid
2012-03-02 13:24 ` Karel Zak
@ 2012-03-03 3:28 ` Balamurugan Arumugam
0 siblings, 0 replies; 4+ messages in thread
From: Balamurugan Arumugam @ 2012-03-03 3:28 UTC (permalink / raw)
To: Karel Zak; +Cc: util-linux
Hi Karel,
>
> On Fri, Mar 02, 2012 at 06:18:13AM -0500, Balamurugan Arumugam wrote:
> > We are trying to parse blkid output in python for all devices and
> > their attributes.
>
> Why? Maybe we can help you...
>
> Do you know that udev db already contains all the attributes? Try:
>
> udevadm info --export-db
>
> See also lsblk --help, it returns many information about block
> devices.
>
I found lsblk is useful and replacing our usage of blkid. Thanks for your help.
> > I found two strange things.
> > 1. udev format output is grouped by empty newline, but I see an
> > extra newline in between.
> > Below is the example,
>
> See Thomas's response, this output format is deprecated. Use "-o
> export".
>
> Unfortunately, the "export" format does not contain devname too.
> This
> problem should be fixed in git tree now. (Thanks for bug report.)
>
> > [root@fedora-16-test ~]# blkid -c /dev/null -o udev
>
> The command blkid without '-p' returns only small subset of all
> available attributes. The command blkid was originally designed
> for LABEL/UUID conversion to devname. The cache (high-level API of
> the library) does not contain more information.
>
> I'd like to remove the cache from blkid command and use the
> low-level
> (-p) by default one day. The cache is confusing for many people...
>
>
> My suggestion is to read the information from udev db (you can use
> libudev too) or use something like:
>
> for x in $(lsblk --output KNAME); do
> blkid -p -o export /dev/$x
> echo
> done
>
> I hope that one day the for() will be unnecessary and blkid without
> -p will return all information.
>
libudev python binding is the way to go than 'ugly' parsing of command output.
Cheers,
Bala
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-03-03 3:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <5f2c4b72-cda0-4618-ae7c-b89333c1d2b9@zmail01.collab.prod.int.phx2.redhat.com>
2012-03-02 11:18 ` unclear udev format output of blkid Balamurugan Arumugam
2012-03-02 12:16 ` Thomas Bächler
2012-03-02 13:24 ` Karel Zak
2012-03-03 3:28 ` Balamurugan Arumugam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox