How does the fstab 'defaults' option work? Is relatime recommended?
I know the fstab defaults
option means this: rw,suid,dev,exec,auto,nouser,async
.
But what if I want to add one more option, for example relatime
, should I still add defaults too or they are applied anyway? Is it needed to add at least one option?
Some examples:
1. UUID=bfb42838-d866-4233-9679-96e7536356df /media/data ext3 defaults 0 2
2. UUID=bfb42838-d866-4233-9679-96e7536356df /media/data ext3 0 2
3. UUID=bfb42838-d866-4233-9679-96e7536356df /media/data ext3 defaults,relatime 0 2
4. UUID=bfb42838-d866-4233-9679-96e7536356df /media/data ext3 relatime 0 2
Is the (2) correct(no option at all)? Are the (1) and (2) the same? Are the (3) and (4) the same?
Furthermore, I read in the Ubuntu Community Documentation that in Ubuntu 8.04 relatime was used as default for linux native file systems. Is it still true for 12.04? If yes, then why do I see this if I use the mount command:
/dev/sda2 on / type ext4 (rw,errors=remount-ro)
If no, why not? It isn't recommended to use relatime
now? I just wanted to apply it to my non system partitions, it is a good idea?
EDIT:
I found an other command to list the mounted partitions and their options:
cat /proc/mounts
This is the result of a partition mounted with the defaults
option in fstab:
/dev/sdb2 /media/adat ext3 rw,relatime,errors=continue,barrier=1,data=ordered 0 0
This is the output of mount
for the same partition:
/dev/sdb2 on /media/adat type ext3 (rw)
And here is both result if the same partition mounted from Nautilus as a non-root user:
/dev/sdb2 /media/adat ext3 rw,nosuid,nodev,relatime,errors=continue,barrier=1,data=ordered 0 0
/dev/sdb2 on /media/adat type ext3 (rw,nosuid,nodev,uhelper=udisks)
So it looks like relatime
is used if we mount an ext
partition in 12.04. So it is unneeded to add it manually. So my problem is broadly solved. But I still can't see why the options that should be in the defaults
are not listed even with the cat /proc/mounts
. Maybe there is a third and even better method to list the partition mount options :)
I believe you need to have something in the "options" column in /etc/fstab, or the mount command will try using the next column and probably won't work. So if you have no specific changes, then "defaults" should be put there.
Relatime is recommended on laptops and desktops with solid-state drives - it avoids a lot of extra hard drive writes, thereby improving battery and SSD life. 'relatime' has been included in the linux kernel defaults since linux version 2.6.30, so there is no reason to specify it unless you are running a very old kernel. Having it specifically listed as 'defaults,relatime' won't break anything though.