Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

blkid

Show the UUID, label and type of file systems and swap spaces — the values you need for /etc/fstab.

Niveau
RHCSA-examen
Groep
Schijven en bestandssystemen
Root nodig
Voor wijzigingen
Pakket
util-linux

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

blkid reads the signatures on block devices and prints them as NAME="value" pairs: UUID, LABEL, TYPE, PARTUUID, PARTLABEL. Without root it may show cached (old) data; run it as root for fresh values.

Zo schrijf je het

blkid [OPTION]... [DEVICE]...
blkid -L LABEL | -U UUID

Opties 20

Meest gebruikt

-s, --match-tag TAG
Show only this tag (UUID, LABEL, TYPE …).
-o, --output FORMAT
value, device, export, full, list, udev.
-L, --label LABEL
Print the device with this label.
-U, --uuid UUID
Print the device with this UUID.
-t, --match-token NAME=VALUE
Only devices with this tag value, like TYPE=xfs.
-n, --match-types LIST
Only these file system types (with -p).
-u, --usages LIST
Only these usages (filesystem, raid, crypto, other).
-p, --probe
Low-level probe, no cache.
-i, --info
I/O limits of the device.
-k, --list-filesystems
List all known types.
-l, --list-one
Only the best match (with -t).
-c, --cache-file FILE
Use another cache file.
-g, --garbage-collect
Clean the cache.
-d, --no-encoding
Do not encode special characters.
-D, --no-part-details
No partition table details.
-H, --hint SETTING
Probing hints.
-O, --offset OFFSET
Probe at an offset.
-S, --size SIZE
Size of the device to probe.
-h, --help
Show help.
-V, --version
Show the version.

Voorbeelden 10

$ als gewone gebruiker# als root (of met sudo)

  1. 1All devices

    blkid
    /dev/vdb1: LABEL="data" UUID="4e5c7a6b-3f1d-4c2e-9a5b-7d2f8e1c0a93" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="2a9b…"

    UUID for fstab, TYPE for the type field.

  2. 2One device

    blkid /dev/vdb1

    Only that partition.

  3. 3Only the UUID value

    blkid -s UUID -o value /dev/vdb1
    4e5c7a6b-3f1d-4c2e-9a5b-7d2f8e1c0a93

    Perfect for scripts.

  4. 4Add an fstab line without typing the UUID

    echo "UUID=$(blkid -s UUID -o value /dev/vdb1) /data xfs defaults 0 0" >> /etc/fstab

    No typing mistakes.

  5. 5Find the device of a UUID or label

    blkid -U 4e5c7a6b-3f1d-4c2e-9a5b-7d2f8e1c0a93
    /dev/vdb1
    blkid -L data

    The reverse lookup.

  6. 6All XFS file systems

    blkid -t TYPE=xfs

    Filter by type.

  7. 7As shell variables

    eval $(blkid -o export /dev/vdb1); echo $TYPE $UUID

    Use the values in a script.

  8. 8Probe without cache

    blkid -p /dev/vdb1

    Fresh data, also for partitions without a file system.

  9. 9Find duplicate UUIDs (cloned disks)

    blkid -s UUID -o value | sort | uniq -d

    Duplicates cause mount and LVM problems.

  10. 10Find encrypted volumes

    blkid -t TYPE=crypto_LUKS

    LUKS-encrypted partitions.

Exitcodes

0 :: Done. 2 :: Nothing found. 4 :: Usage error. 8 :: Ambivalent result (more than one signature).