0

From man chattr

When a file with the 'A' attribute set is accessed, its atime record is not modified. This avoids a certain amount of disk I/O for laptop systems.

However when I am remounting a filesystem with the noatime mount option:

[root@localhost ~]# mount -o remount,noatime /dev/sdb1 /newfs/

creating a file in it

[root@localhost ~]# cd /newfs/
[root@localhost newfs]# touch myfile

and getting its file attributes:

[root@localhost newfs]# lsattr myfile 
-------------e-- myfile

the A file attribute is not set despite the fact.

Is this the expected behavior?

  • lsattr(1) does not list the extended attributes and chattr(1) does not change them. Both commands are working with the file attributes which are extra inode flags supported by some filesystems with like ext4, btrfs or xfs. The two are completely unrelated and independent. Extended attributes are notably used to implement file capabilities(7), selinux (security.selinux) and ACLs (system.posix_acl_access). – mosvy Apr 23 at 13:00
3

Yes, this is expected: the two behaviours are orthogonal. Setting the A attribute on a file ensures that its access time is never updated, irrespective of mount options. Mounting a file system with noatime ensures that no access time is updated on it, irrespective of file attributes.

Mounting a file system with a given set of options doesn’t affect any related attributes on files created while the options are active; thus files created with noatime active don’t have the A attribute automatically set, just like it’s possible to create device nodes on a file system mounted with nodev, or executables on a file system mounted with noexec.

1

It is the expected behaviour.

Either of them will prevent the atime being updated, but they are independent.

The kernel has no system call to query the overall status. You have to check both of them yourself.

  • 1
    but yield the exact same end result I assume? – pkaramol Apr 22 at 15:45
  • Yes, the end result is the same. – Stephen Kitt Apr 22 at 18:32

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.