• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to use “xfs_admin” command to change parameters of an XFS filesystem

by admin

Use the xfs_admin command to change the parameters of an XFS file system. You can also use the xfs_admin command to view the file system label and UUID:

# xfs_admin -lu /dev/mapper/vg_test-lv_test 
label = "XFS"
UUID = e6c8b645-b1c8-4911-9597-4e1ea2ab22ba

You must unmount the file system before changing parameters with the xfs_admin command. With the file system unmounted, you can change the following parameters:

  • -L [label]: Use this option to change the file system label.
  • -U [UUID]: Use this option to change the file system UUID.

If you try changing any parameter while the XFS filesystem is mounted, you would get an error similar to shown below.

# xfs_admin -L new_label /dev/mapper/vg_test-lv_test 
xfs_admin: /dev/mapper/vg_test-lv_test contains a mounted filesystem

fatal error -- couldn't initialize XFS library

Changing XFS filesystem Label

To change the Label of an XFS file system (/data) use the below command.

# umount /data
# xfs_admin -L new_label /dev/mapper/vg_test-lv_test 
writing all SBs
new label = "new_label"

Verify the new label using the below command.

# xfs_admin -l /dev/mapper/vg_test-lv_test 
label = "new_label"

You can not use label with more than 12 characters long. The filesystem label can be cleared using the special “–” value for label. For example:

# xfs_admin -L -- /dev/mapper/vg_test-lv_test 
writing all SBs
new label = ""
# xfs_admin -l /dev/mapper/vg_test-lv_test 
label = ""

Changing the UUID of XFS filesystem

Similar to the XFS filesystem label, the UUID can also be changed with “xfs_admin” command. Use the below command to set a new XFS UUID.

# xfs_admin -U c1b9d5a2-f162-11cf-9ece-0020afc76f16 /dev/mapper/vg_test-lv_test 
Clearing log and setting UUID
writing all SBs
new UUID = c1b9d5a2-f162-11cf-9ece-0020afc76f16

Verify the new UUID of XFS filesystem using below command.

# xfs_admin -u /dev/mapper/vg_test-lv_test 
UUID = c1b9d5a2-f162-11cf-9ece-0020afc76f16

The uuid may also be nil, which will set the filesystem UUID to the null UUID. For example,

# xfs_admin -U nil /dev/mapper/vg_test-lv_test 
Clearing log and setting UUID
writing all SBs
new UUID = 00000000-0000-0000-0000-000000000000

Verify the nil UUID with the below command.

# xfs_admin -u /dev/mapper/vg_test-lv_test 
UUID = 00000000-0000-0000-0000-000000000000

Enabling lazy counters

You can also use the xfs_admin command to enable or disable lazy counters. With lazy counters enabled, the superblock is not modified or logged when changes are made to the free-space and inode counters. Information is stored in other parts of the file system to maintain the counter values. This provides significant performance improvements in some configurations. Enabling and disabling lazy counters is time-consuming on large file systems because the entire file system must be scanned. To enable and disable lazy counters:

  • -c 1: Enables lazy counters
  • -c 0: Disables lazy counters

Filed Under: CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. How to take mailbox backup of Zimbra Account from CLI
  2. How to extract RPM package without installing it
  3. How To Configure SNMP Daemons: snmpd and snmptrapd on CentOS/RHEL 5,6 and 7
  4. rc-update: command not found
  5. CentOS / RHEL : How to identify/match LUN presented from SAN with underlying OS disk
  6. protonvpn-cli Command Examples in Linux
  7. LVM Configuration : Logical Volume (LV) Operations/Utilities
  8. Status Commands in Linux – date, ps, who, uptime, finger, rup, ruser
  9. LVM Snapshot: Backup and restore LVM Partition in Linux
  10. hostnamectl Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • gml2gv Command Examples
  • glow Command Examples
  • glib-compile-resources Command Examples
  • glances Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright