Le 29/06/2017 à 17:16, Adam Borowski a écrit :
On Thu, Jun 29, 2017 at 03:15:33PM +0200, Didier Kryn wrote:
Le 29/06/2017 à 14:51, [email protected] a écrit :
Hmm, something similar could be used to create thoose /dev/disk/by-*,
for a static /dev:
find /dev -type b | xargs blkid | sort | some_script_to_populate_by_xxx
But if that is only a transformed /sys/class/block, wouldn't it be
easier if there was a /sys/class/uuid or similar ?
Everybody is using blkid to build thiese links, my script as well as Udev
and Vdev. You probably noticed that blkid has a special option for Udev
because Udev people are too lazzy to parse the response. In Vdev, Jude made
the parsing job to be compatible with Busybox's blkid which hasn't this
special format.
So blkid authors on one hand provide a special format for Udev to create
the symlinks, and on the other hand claim that they aren't reliable!
Also man blkid says:
# It is recommended to use lsblk(8) command to get information about
# block devices rather than blkid. lsblk(8) provides more information,
# better control on output formatting and it does not require root per‐
# missions to get actual information.
So as you're making a new tool to parse this information, it's better to
use the newest and greatest source, thus avoiding that deprecated format.
Using the library rather than a cmdline program is also an option.
blkid does not require root permission. It will actually examine
the block device if you are root; otherwise it will read its cache.
AFAIU, this means you rely on some service ( the hotplugger) to invoke
it as root and refresh the cache when something happens. I hope lsblk is
more than a wrapper for blkid :-)
Didier
_______________________________________________
Dng mailing list
[email protected]
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng