From: Karel Zak <kzak@redhat.com>
To: Balamurugan Arumugam <barumuga@redhat.com>
Cc: util-linux@vger.kernel.org
Subject: Re: unclear udev format output of blkid
Date: Fri, 2 Mar 2012 14:24:53 +0100 [thread overview]
Message-ID: <20120302132453.GG18642@x2.net.home> (raw)
In-Reply-To: <249be96a-803a-4d00-b5b1-ff3f18722a36@zmail01.collab.prod.int.phx2.redhat.com>
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
next prev parent reply other threads:[~2012-03-02 13:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 [this message]
2012-03-03 3:28 ` Balamurugan Arumugam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120302132453.GG18642@x2.net.home \
--to=kzak@redhat.com \
--cc=barumuga@redhat.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox