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 new_label /dev/mapper/vg_test-lv_test writing all SBs new 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