how to know if noatime or relatime is default mount option in kernel?

17

5

I was trying to know if relatime or noatime was set on a filesystem, but i didn't found the information, neither in /etc/fstab, neither in kernel boot options.

First of all, it seems clear that i don't have the "normal" behaviour on atime:

root@antec:/tmp# rm -f test.txt; echo a>test.txt

root@antec:/tmp# stat test.txt | \grep -i 2011
Access: 2011-08-01 21:54:30.000000000 +0200
Modify: 2011-08-01 21:54:30.000000000 +0200
Change: 2011-08-01 21:54:30.000000000 +0200

root@antec:/tmp# cat test.txt > /dev/null

root@antec:/tmp# stat test.txt | \grep -i 2011
Access: 2011-08-01 21:54:53.000000000 +0200
Modify: 2011-08-01 21:54:30.000000000 +0200
Change: 2011-08-01 21:54:30.000000000 +0200

root@antec:/tmp# date
Mon Aug  1 21:55:00 CEST 2011

root@antec:/tmp# cat test.txt > /dev/null

root@antec:/tmp# stat test.txt | \grep -i 2011
Access: 2011-08-01 21:54:53.000000000 +0200 <--- atime not modified
Modify: 2011-08-01 21:54:30.000000000 +0200
Change: 2011-08-01 21:54:30.000000000 +0200
root@antec:/tmp#

I have two questions:
- Is noatime or relatime a default mount options, and if yes, from which kernel release ?
- Is there a way to see the default mount options (ie: how can i see why i don't have the "normal" atime behaviour ?)
Many questions but i think they are related. Feel free to edit the title if you have a more explicit title.

user368507

Posted 2011-08-01T20:09:02.827

Reputation: 271

maybe ask at serverfault.com – None – 2011-08-01T20:12:09.487

Answers

15

This should list all the options a file system was mounted with:

cat /proc/mounts

Clarus

Posted 2011-08-01T20:09:02.827

Reputation: 674

Or just type mount without any parameter, that's gonna basically do a cat /proc/mounts but it's a nice shorthand. – Csaba Toth – 2016-07-25T03:18:04.763

thanks. I see that "mount" does not show everything! Do you know where do the "additionnal" mount options (ie: those shown in /proc/mounts but not in /etc/fstab) come from ? I mean, where the kernel reads them ? – None – 2011-08-01T20:26:01.193

The kernel contains the default values appended as file system options if no particular value is specified. The exact values of the default options are contained in the kernel config when you compile the kernel. – Clarus – 2011-08-01T20:46:57.607

google returns nothing on "CONFIG_ relatime" and grep -i relatime .config returns nothing on my machine. What did i miss ? – None – 2011-08-01T20:52:57.970

Check http://kerneltrap.org/node/14148

– Clarus – 2011-08-01T21:25:16.867

The link talks about a "CONFIG_DEFAULT_RELATIME" kernel option, but i cannot find this option, it is not in the kernel sources (I have check in 2.6.36 and 3.0), neither in my .config. I don't understand why CONFIG_DEFAULT_RELATIME does not exist in the kernel sources – None – 2011-08-02T07:39:45.347

2

This question is pretty old, but you can look at default mount options for an ext filesystem with:

tune2fs -l /dev/<device>

James Hewitt

Posted 2011-08-01T20:09:02.827

Reputation: 21

And how would someone install that program, since it does not appear to be a standard inclusion? – underscore_d – 2015-10-05T10:25:02.747

1@underscore_d use "apt-get install e2fsprogs" or the appropriate local equivalent. – Peter Hansen – 2015-10-07T17:28:59.547

0

nfsstat -m will give you a listing of all NFS mounts and flags.

With that said, I had to use cat /proc/mounts on an older 2.6.5 kernel, since nfsstat -m wasn't supported then.

Banjer

Posted 2011-08-01T20:09:02.827

Reputation: 387