Xfs mount option 'attr2'

Hi there.

I have my ‘/’ on xfs filesystem since years. Just recently I saw the following message at the very end of the poweroff/reboot process:

XFS: attr2 mount option is deprecated

I do not know when this message appeared for the first time. I am aware of it just for a few days now.

When I look at /proc/mounts I see the option:

# grep xfs /proc/mounts                
/dev/nvme1n1p2 / xfs rw,noatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0

But where is is coming from? My /etc/fstab does not have it:

UUID=0a765f87-6eca-4e05-bd1a-xxxx / xfs defaults,noatime 0 1

And in the journal I dop not find any trace of attr2. There is no complained about a deprecated mount option at all. The last message “XFS: attr2 mount option is deprecated” is coming too late for the journal. It is only on screen.

Where is this attr2 option comint from? I do not find a trace of it in the util-linux source code (source of the mount command).

I don’t use it, but according to the man page, it’s already been set as the default (deprecated since kernel 5.10).

Seems to be the default for XFS when you create the filesystem:

To create a new filesystem on device use:

mkfs.xfs device

In general, the default options are optimal for common use.[1][2]

Sample output:

meta-data=/dev/device isize=256 agcount=4, agsize=3277258 blks = sectsz=512 attr=2 data = bsize=4096 blocks=13109032, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 log =internal log bsize=4096 blocks=6400, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0

https://wiki.archlinux.org/title/XFS#Creation

attr2|noattr2
Note: These options have been deprecated as of kernel v5.10; The noattr2 option will be removed no earlier than in September 2025 and attr2 option will be immutable default.

https://man.archlinux.org/man/xfs.5#attr2

Does that mean this option is written to disc? This is hard to believe for me. How would a solution to this warning look like then?

That’s how I understood it from the excerpt of the ArchWiki. It seems to be a “property” of the filesystem itself.

I found an old-ish thread from Arch forum which has a link to a proposed kernel patch to just remove this warning. Could it be that the patch is not yet implemented?

Yes, I saw this thread as well. Thats why I grep’ed through the util-linux source code. But I could not find a trace of the attr2 option. Except for the v2.17-ReleaseNotes (which is several years old) where is says:

- fix mount.8, xfs attr2 is enabled by default [Karel Zak]

But that it is. No trace of the attr2 in the source code. So how could a remount of the root file system introduce the attr2 option?

1 Like

I am wondering if this is a kernel thing. May be the kernel introduces attr2 in the fs/xfs section. I am currently checking the full linux git tree.

1 Like

I have checked the kernel source. There are a couple of changes related to the attr2 option resp. deprecated xfs options in it. It looks like attr2 is added to the mount options by default.

I have tested kernel 6.16 (I am normally running 6.12 LTS). With 6.16 I do not see the warning anymore. Nevertheless, even with kernel 6.16 I see the attr2 option in /proc/mounts.

I leave it at that. Waiting for kernel 6.18 and zfs supporting it. I assume 6.18 is the next LTS kernel and will not have attr2 anymore.

At this point I am not sure if I have understood the issue correctly.

What I understand is that attr2 is a property of the file system attributed to it when making the filesystem by mkfs.xfs.

What has been deprecated is the use of the mount options for attr2. And what has been removed in the new kernels is the warning about the mount option being deprecated.

https://man.archlinux.org/man/xfs.5#attr2
attr2 option will be immutable default

Is that correct?

Me too. This is totally confusing.

Mount options like attr2 have been deprecated with kernel 5.10 already.
commit c23c393eaab5d3097d8b95e5bcbbe73e089a6165 “xfs: remove deprecated mount options”

The reason was, that attr2 is the default for xfs V5. There is no need for a mount option of that name anymore.

With kernel 6.18 the deprecated mount options are being removed for good.
commit b9a176e54162f890aaf50ac8a467d725ed2f00df “xfs: remove deprecated mount options”

Confusing is that both commits talk about removing the mount options. The first commit actually only removes the options from the command line so to speak. The second commit removes the full C code related to these options.

But I could not figure out the commit between kernel 6.12 and 6.16 which removes the warning about the deprecated option.

And I could not figure out why attr2 shows up as an option in /proc/mounts.

1 Like