Get an XFS mount option wrong and you can end up staring at an unmountable filesystem. This guide identifies, mounts and inspects one with deliberate options.
Examples use xfs(5) from the Ubuntu xfsprogs package version 6.6.0-1ubuntu2.1, XFS utilities reporting version 6.6.0.
Allow about fifteen minutes for an existing, unmounted filesystem. You need a shell, the xfsprogs package, a block device or image that really contains XFS, and a mount point. Most inspection commands are ordinary user commands; mounting, unmounting and reading another user's block device normally need sudo.
Safety boundary: these steps do not create a filesystem, repair one, grow one or change its persistent configuration. Never substitute a guessed device for the placeholder below. A wrong device can expose, corrupt or destroy unrelated data.
Check the installed utilities first:
$ command -v xfs_info xfs_growfs xfs_admin
/usr/sbin/xfs_info
/usr/sbin/xfs_growfs
/usr/sbin/xfs_admin
$ xfs_info -V
xfs_info version 6.6.0
Replace /dev/EXAMPLE_XFS below with the actual source, such as a filesystem device or logical volume. Inspect candidates with lsblk without changing anything:
$ lsblk -o NAME,PATH,FSTYPE,LABEL,UUID,SIZE,MOUNTPOINTS
$ sudo blkid /dev/EXAMPLE_XFS
Look for TYPE="xfs" and compare the UUID with your inventory.
Warning: do not use dd to copy an XFS filesystem casually. The manual warns that duplicate UUIDs can confuse xfsdump during incremental or resumed dumps; use xfsdump and xfsrestore for filesystem copies instead.
Checkpoint: stop here if the device is mounted somewhere else, the type is not XFS, or the UUID is not the one you expected.
Pick a directory nothing else is using. Creating it is a state change, so check first:
$ findmnt /mnt/example-xfs
TARGET SOURCE FSTYPE OPTIONS
$ sudo install -d -m 0755 /mnt/example-xfs
An empty result from findmnt means that exact path is not currently a mount point, and install creates the directory if needed. Made the directory only for this test? The undo after unmounting is sudo rmdir /mnt/example-xfs, but only once it is empty and yours to remove.
For a first look, mount read-only. That avoids ordinary file writes while still letting the kernel perform the checks a mount needs.
$ sudo mount -t xfs -o ro /dev/EXAMPLE_XFS /mnt/example-xfs
$ findmnt -no SOURCE,FSTYPE,OPTIONS /mnt/example-xfs
/dev/EXAMPLE_XFS xfs ro,relatime
The exact option list can include kernel or distribution defaults; the checks that matter are the expected source, xfs as the type, and a read-only option present. Mount failing? Preserve the error text and stop.
Warning: do not respond to a failed mount by trying norecovery, nouuid or repair tools at random. XFS recovery has its own separate concern: do not add norecovery unless you are mounting a read-only snapshot and understand the consistency trade-off, the manual says an unclean filesystem can be inconsistent in that mode.
Checkpoint: inspect a small directory without writing to the filesystem:
$ sudo xfs_info /mnt/example-xfs
meta-data=/dev/EXAMPLE_XFS isize=512 agcount=...
data = bsize=... blocks=...
log =internal log bsize=... blocks=...
realtime =none extsz=... blocks=...
Allocation-group count and block totals are filesystem-specific. xfs_info only inspects; it does not resize anything.
Start from no XFS-specific option and add only what you can explain:
inode64 allows inode creation anywhere in the filesystem and is the default for kernels v3.7 and later. Use inode32 only for an application that cannot handle inode numbers over 32 bits.discard issues discard commands as blocks are freed. It can help SSDs, thin-provisioned LUNs and VM images, but the manual recommends fstrim instead, since continuous discard can hurt performance badly. The XFS default is nodiscard.uquota, gquota and pquota enable user, group and project quota accounting, with enforcement controlled by related options. Add these only when quota administration is part of the design.logdev=DEVICE and rtdev=DEVICE select a separate log or real-time device. These are layout decisions, not generic performance switches.If host policy specifically requires user quota accounting, mount a test filesystem with that option and verify it in the reported options:
$ sudo umount /mnt/example-xfs
$ sudo mount -t xfs -o ro,uquota /dev/EXAMPLE_XFS /mnt/example-xfs
$ findmnt -no OPTIONS /mnt/example-xfs
ro,relatime,uquota
Unmounting before changing the option avoids confusing a remount with a fresh mount. A production remount can affect running applications, so schedule it as an operational change.
nouuid disables the duplicate-UUID check. It is useful for mounting an LVM snapshot in a controlled, read-only workflow, often alongside norecovery, but it removes a real protection against mounting the same filesystem twice. Do not add it just because an ordinary mount failed.
Warning: norecovery must be read-only and can leave an unclean filesystem inconsistent. Do not use it on the only copy of important data.
The manual also lists delaylog, ihashsize, barrier and other removed options; a recipe containing one of them is for an obsolete kernel and should not go into a current /etc/fstab. attr2 and noattr2 are deprecated in the installed manual too: CRC-enabled filesystems always use the attr2 format and reject noattr2, so neither is a compatibility charm worth reaching for.
Leave the filesystem the way you found it when you are done:
$ sudo umount /mnt/example-xfs
$ findmnt /mnt/example-xfs
$ ls -ld /mnt/example-xfs
No output from findmnt confirms it is no longer mounted. If umount says the target is busy, find the process or shell holding it with sudo fuser -vm /mnt/example-xfs, change to another directory, stop only the process you recognise, and retry.
Warning: do not reach for a forced unmount as a first response.
ro and was checked with findmnt and xfs_info.nouuid, norecovery and obsolete options were not added casually.