15

How to check the version of a XFS filesystem on a system, whether it is V5 or later?

sebasth
  • 14,332
  • 4
  • 50
  • 68
MikasaAckerman
  • 339
  • 1
  • 3
  • 9

3 Answers3

12

You can check the on disk format version of a XFS file system with xfs_db.

Example output of an old (V4) XFS file system on my system:

xfs_db -r /dev/...
xfs_db> version
versionnum [0xb5b4+0x8a] = V4,NLINK,DIRV2,ATTR,ALIGN,DALIGN,LOGV2,EXTFLG,MOREBITS,ATTR2,LAZYSBCOUNT,PROJID32BIT

Output of a new (V5) XFS file system (created with xfsprogs version 4.9.0):

xfs_db -r /dev/...
xfs_db> version
versionnum [0xb4a5+0x18a] = V5,NLINK,DIRV2,ALIGN,LOGV2,EXTFLG,MOREBITS,ATTR2,LAZYSBCOUNT,PROJID32BIT,CRC,FTYPE,FINOBT
sebasth
  • 14,332
  • 4
  • 50
  • 68
11

Since version 3.15, the kernel tells you the version of XFS used in each filesystem as it mounts it; dmesg | grep XFS should give you something like

[1578018.463269] XFS (loop0): Mounting V5 Filesystem

Instead of loop0 on your system you'll get the underlying device, and V5 will be replaced by whatever version your filesystem uses.

Older kernels officially supported XFS version 4 filesystems, but could mount version 5 filesystems (since mid 2013); for the latter, the kernel would print

Version 5 superblock detected. This kernel has EXPERIMENTAL support enabled!

when the filesystem was mounted.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
  • I get something like this: 1.342982] SGI XFS with ACLs, security attributes, large block/inode numbers, no debug enabled [ 1.345446] XFS (dm-0): Mounting Filesystem [ 1.497979] XFS (dm-0): Starting recovery (logdev: internal) [ 1.587471] XFS (dm-0): Ending recovery (logdev: internal) [ 6.980611] XFS (sda2): Mounting Filesystem [ 9.675872] XFS (sda2): Ending clean mount – MikasaAckerman Sep 15 '16 at 19:19
  • @MikasaAckerman OK, that means you're using a kernel older than 3.15, and a version 4 filesystem (see my updated answer for details). – Stephen Kitt Sep 15 '16 at 21:01
  • This answer does not help, when you are unable to mount the filesystem (which in turn could be the reason why you want to find out the version number at all). Happens when you try to mount an XFS filesystem with an older kernel. – U. Windl Feb 15 '21 at 08:16
  • @U.Windl yes, see [sebasth’s answer](https://unix.stackexchange.com/a/464939/86440). – Stephen Kitt Feb 15 '21 at 09:03
-1

We can check using below command.

# yum list installed | grep xfs

enter image description here

# yum info xfsprogs

enter image description here

GAD3R
  • 63,407
  • 31
  • 131
  • 192
Babin Lonston
  • 3,311
  • 3
  • 18
  • 24
  • 5
    This only shows the installed version of xfsprogs tools. The question is about the the version of file system on disk format on an existing file system. xfsprogs version doesn't tell which on disk format version is used on existing file systems: file systems created with older versions of xfsprogs will have an older on disk format version. – sebasth Aug 26 '18 at 17:04