I am trying to get extended attributes working on Fedora 22. I can't seem to be able to set the attributes even on my files, but I can read them. Here's how it looks:
[jarek@localhost ~]$ cd /tmp/ [jarek@localhost tmp]$ touch a [jarek@localhost tmp]$ setfattr -n "user.abc" -v "blah" a setfattr: a: Operation not supported [jarek@localhost tmp]$ sudo setfattr -n "user.abc" -v "blah" a setfattr: a: Operation not supported [jarek@localhost tmp]$ strace setfattr -n "user.abc" -v "blah" a ... setxattr("a", "user.abc", "blah", 4, 0) = -1 EOPNOTSUPP (Operation not supported) ... +++ exited with 1 +++ [jarek@localhost tmp]$ getfattr a [jarek@localhost tmp]$ echo $? 0
Some information about my system:
[jarek@localhost ~]$ uname -a Linux localhost.localdomain 4.1.5-200.fc22.x86_64 #1 SMP Mon Aug 10 23:38:23 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux [jarek@localhost test]$ mount |grep /dev/sda5 /dev/sda5 on / type ext4 (rw,noatime,seclabel,discard,data=ordered)
Does anyone have an idea what am I doing wrong? This works on Ubuntu 14.04.
Edit
That is indeed on /tmp
which is a tmpfs
, not ext4
file system on my system.
Best Answer
You don’t mention it in your text, but your code block shows that you are doing your test in
/tmp
. Even if your root filesystem (HDD or SSD) is ext4, you might have/tmp
mounted as a separate filesystem, probably of type tmpfs, and that does not support extended attributes. You can check whether this is the case by executing any of the following commands:mount | grep tmp
df /tmp
grep /tmp /etc/fstab
The fact that the
getfattr
succeeds is a little surprising, but not very. I guess some developer thought it would be harmless to report that a file has no extended attributes when the filesystem doesn’t support extended attributes. After all, it’s true — the file has no extended attributes.