My host filesystem is ext4
mounted with the noatime
flag. But inside an lxc-container, the flag is absent.
Here's the output of mount
on the host:
/dev/sdb1 on /home type ext4 (rw,noatime)
And here's the output of mount
in the container:
/dev/sdb1 on / type ext4 (rw)
I now have two questions:
1. Does it make a difference if noatime
is set in the container?
My guess is yes.
2. What is the best way to set noatime
for the container?
Ideally, I would like to configure such a way, that it honors the host's file system flags always.
Update
The /proc/mounts
shows slightly different entries:
rootfs / rootfs rw 0 0
/dev/sdb1 /home ext4 rw,noatime 0 0
My guess is that when a system call writes to a file, the kernel code that implements that looks at the noatime flag's status and gets that info from the same kernel routine that provides the info to proc filesystem.
However, that's far from an authoritative view, and if it matters, you should verify it.
Does the atime actually get updated? Check in both the host and hosted system. I doubt the time is recorded differently, but again, that's a guess.
Depending how long you need to count on the answer being correct, you might also need to go hunting for an authoritative answer on what the behaviour is supposed to be. If this is not currently working as intended, it might change in future, and remember that LXC is still not all that far past it's first production release. Asking questions can help stabilise the answer, but maybe take it to an LXC developer list?
I think it is a bug in how /etc/mtime file is updated. Check /proc/mounts in both container and on the host.
Not really an answer, more a thought: other then one would believe, the basic fs tools (mount,df) use /etc/mtime, which is simple textfile written by mount and other tools, as source for fs/mount information. If you are chrooted your /etc/mtab may or may not have contents reflecting the real situation on your system, depending on when the chrooted /etc/mtab was created. Your /etc/mtab in the container is obviously not reflecting the actual config (as seen in /proc/mounts).