Systemd/extras/volume_id
Kay Sievers b8476286d6 store the imported device information in the udevdb
Any program can query with udevinfo for persistent device
attributes evaluated on device discovery now.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-26 18:55:24 +02:00
..
volume_id [PATCH] udev_volume_id: fix endianess macros 2005-04-26 23:55:00 -07:00
Makefile rename udev_volume_id to vol_id and add --export option 2005-06-26 01:54:47 +02:00
README rename udev_volume_id to vol_id and add --export option 2005-06-26 01:54:47 +02:00
vol_id.c store the imported device information in the udevdb 2005-06-26 18:55:24 +02:00

vol_id - partition, filesystem, disklabel reader

This program is normally called from a udev rule, to provide udev with the
name, uuid or the filesystem type of a partition to name a device node.
vol_id opens the blockdevice node specified at the commandline.
The following commandline switches are supported to specify what vol_id
should print:

  --export prints all values
  -h       prints help text
  -l       prints the label of the partition
  -u       prints the uuid of the partition

vol_id will only return successful if the string asked for, is not
empty. All trailing whitespace will be removed, spaces replaced by underscore
and slashes ignored.

fstype                 probe  label  uuid  fsversion
----------------------------------------------------
ext                    *      *      *     *
reiserfs jr/3.5/3.6/4  *      *      *     *
fat (12, 16, 32)       *      *      *     *
ntfs                   *      *      *     *
jfs                    *      *      *     -
xfs                    *      *      *     -
hfs (plus, wrapped)    *      *      *     -
udf                    *      *      -     -
iso9660                *      *      n/a   -
ufs                    *      -      -     -
linux swap             *      *      *     *
LVM 1                  *      -      -     -
LVM 2                  *      -      -     *
linux raid             *      -      *     *
cramfs                 *      *      -     -
sysv                   *      *      -     *
luks                   *      -      *     -
hpfs                   *      -      -     -
romfs                  *
minix                  *
dasd                   *
highpoint              *
isw_raid               *
lsi_raid               *
nvidia_raid            *
promise_raid           *
silicon_raid           *
via_raid               *
mac partitons          *
msdos partitions       *


The following rule will create a symlink named with the label string:
  KERNEL=="[hs]d*", PROGRAM=="/sbin/vol_id -l %N", SYMLINK+="%c"

If no label is found vol_id exits with nonzero and the rule will be
ignored.

To give it a try, you may call it on the commandline:
  [root@pim udev.kay]# extras/volume_id/vol_id /dev/hda3
  T:ext3
  L:Music Store
  N:Music_Store
  U:d2da42b5-bbd9-44eb-a72c-cc4542fcb71e

  [root@pim udev.kay]# extras/volume_id/vol_id -l /dev/hda3
  Music_Store

  [root@pim udev.kay]# extras/volume_id/vol_id -t /dev/hda3
  swap


Any comment/questions/concerns to me:
Kay Sievers <kay.sievers@vrfy.org>