Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

xfs_admin

Show or change the label, UUID and some features of an XFS file system (unmounted).

Level
RHCSA exam
Group
Disks and file systems
Needs root
Yes
Package
xfsprogs

What it does

xfs_admin changes XFS settings that are fixed at creation, mainly the label and the UUID. The file system must be unmounted for changes (newer versions can set the label of a mounted file system with xfs_io -c 'label -s NAME' MOUNTPOINT).

How to write it

xfs_admin [-eflpu] [-O FEATURES] [-c 0|1] [-L LABEL] [-U UUID] DEVICE [LOGDEV]

Options 12

Most used

-l
Print the label.
-L LABEL
Set the label (max 12 characters; -- = remove).
-u
Print the UUID.
-U UUID|generate|nil|restore
Set a new UUID.
-O FEATURE=STATUS, ...
Change features, like bigtime=1, inobtcount=1.
-c 0|1
Turn lazy counters off or on.
-e
Enable unwritten extents (old file systems).
-j
Enable version 2 log format (old file systems).
-p
Enable 32-bit project IDs.
-f
The DEVICE is an image file.
-r RTDEV
The realtime device.
-V
Show the version.

Examples 10

$ run as a normal user# run as root (or with sudo)

  1. 1Show the label and UUID

    xfs_admin -l -u /dev/vdb1
    label = "data"
    UUID = 4e5c7a6b-3f1d-4c2e-9a5b-7d2f8e1c0a93

    Same values as blkid.

  2. 2Set a label

    umount /data; xfs_admin -L data /dev/vdb1

    Unmount first.

  3. 3Remove the label

    xfs_admin -L -- /dev/vdb1

    Clears it.

  4. 4New UUID for a cloned disk

    xfs_admin -U generate /dev/vdb1

    Two XFS file systems with the same UUID cannot be mounted at the same time.

  5. 5Mount a clone once without changing it

    mount -o nouuid /dev/vdc1 /mnt

    Temporary workaround.

  6. 6Label on a mounted file system (newer xfsprogs)

    xfs_io -c 'label -s data' /data

    No unmount needed.

  7. 7Enable timestamps after 2038

    xfs_admin -O bigtime=1 /dev/vdb1

    New file systems have it by default.

  8. 8Check the result

    lsblk -f /dev/vdb1

    LABEL and UUID columns.

  9. 9Fix fstab after a UUID change

    grep vdb1 /etc/fstab; blkid -s UUID -o value /dev/vdb1

    Update the UUID in fstab or the system may not boot.

  10. 10Info of a mounted XFS

    xfs_info /data

    xfs_admin needs unmounted devices; xfs_info works on mounted ones.

Exit codes

0 :: Done. 1 :: Error.

Full manual

This page explains the command in simple words. The original manual has every detail.

In your terminal: man 8 xfs_admin