Re: unclear udev format output of blkid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux