KnowingUUIDs

Revision 3 as of 2010-01-06 15:01:36

Clear message

1. Knowing UUID and other IDs of block devices

note: this is not only for disks physical partitions, bul also for multi-disk devices (RAID) and logical volume devices (LVM)

1.1. blkid

  • this will list UUID for all known block devices
    <user>@<host>:~$ blkid
    /dev/sda1: LABEL="sda1-boot-2GB" UUID="a596c61a-16b7-4967-890a-38022722b04d" SEC_TYPE="ext2" TYPE="ext3"
    /dev/sda2: ...

1.2. vol_id

Info (!) this command is part of udev package and must be run with administratives privileges (as root or with sudo)

  • short ID list for one device
    <user>@<host>:~# vol_id /dev/sda1
    ID_FS_USAGE=filesystem
    ID_FS_TYPE=ext3
    ID_FS_VERSION=1.0
    ID_FS_UUID=a596c61a-16b7-4967-890a-38022722b04d
    ID_FS_UUID_ENC=a596c61a-16b7-4967-890a-38022722b04d
    ID_FS_LABEL=sda1-boot-2GB
    ID_FS_LABEL_ENC=sda1-boot-2GB
    ID_FS_LABEL_SAFE=sda1-boot-2GB
  • this is just the UUID for one device
    <user>@<host>:~# vol_id -u /dev/sda1
    a596c61a-16b7-4967-890a-38022722b04d

1.3. udevadm

Info (!) this command is part of udev package and must be run with administratives privileges (as root or with sudo)

Warning /!\ this command seems to replace the former udevinfo command

  • the following command (see the short form below) does list the env part of the udev db content, for one device. Valid queries are: name, symlink, path, env, all.

    <user>@<host>:~# udevadm info --query=env --name=/dev/sda1
    ID_VENDOR=ATA
    ID_MODEL=Hitachi_HDT72503
    ID_REVISION=V54O
    ID_SERIAL=1ATA_Hitachi_HDT725032VLA360_xxx
    ID_SERIAL_SHORT=ATA_Hitachi_HDT725032VLA360_xxx
    ID_TYPE=disk
    ID_BUS=scsi
    ID_ATA_COMPAT=Hitachi_HDT725032VLA360_xxx
    ID_PATH=pci-0000:00:05.0-scsi-0:0:0:0
    ID_FS_USAGE=filesystem
    ID_FS_TYPE=ext3
    ID_FS_VERSION=1.0
    ID_FS_UUID=a596c61a-16b7-4967-890a-38022722b04d
    ID_FS_UUID_ENC=a596c61a-16b7-4967-890a-38022722b04d
    ID_FS_LABEL=sda1-boot-2GB
    ID_FS_LABEL_ENC=sda1-boot-2GB
    ID_FS_LABEL_SAFE=sda1-boot-2GB
  • this short form is not documented in udevadm man and has been borrowed from an udevinfo example:

    <user>@<host>:~# udevadm info -q env -n /dev/sda1