الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

blkid

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

المستوى
امتحان RHCSA
المجموعة
الأقراص وأنظمة الملفات
يحتاج root
للتغييرات
الحزمة
util-linux

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

ماذا يفعل

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.

طريقة الكتابة

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

الخيارات 20

الأكثر استخدامًا

-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.

أمثلة 10

$ مستخدم عادي# بصلاحية root (أو مع 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.

رموز الخروج

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