4

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.

  • 1
    Are you sure that /tmp is on the ext4 and not a tmpfs?  What do mount | grep tmp and df /tmp say? – G-Man Sep 4 '15 at 10:19
  • 1
    You're right! This is tmpfs. It works elsewhere where it really is ext4. – JarekD Sep 4 '15 at 10:37
  • And this explains the difference between this and the ubuntu machine - it doesn't use tmpfs in /tmp, just the ext4 mounted on /. – JarekD Sep 4 '15 at 10:41
  • Thank you very much G-Man for your input. If you submit the answer saying what you said in the comment so that I can accept and give you some reputation points. – JarekD Sep 4 '15 at 10:54
  • Try something like "attr -s" – barrycarter Nov 17 '16 at 1:39
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.