2

I'm trying to get my root partition to mount with the atime option on boot. I'm running Ubuntu 14.04.

I've modified my /etc/fstab file:

UUID=334a0fe1-2636-4ee6-93b5-8748c5313c79 / ext4 atime,errors=remount-ro 0

...but that has no effect:

$ mount | head -n1
# => /dev/sda1 on / type ext4 (rw,errors=remount-ro)

What is it that I need to do, please?

3
  • 1
    As far as I know, atimemostly is the default option, so you don't need to define that. It's just used with mount operations to override default noatimeoption.
    – ridgy
    Dec 10, 2017 at 19:49
  • 1
    @ridgy : I believe that since 2007, relatime has been the default. man mount says of relatime: Since Linux 2.6.30, the kernel defaults to the behavior provided by this option (unless noatime was specified), and the strictatime option is required to obtain traditional semantics.
    – Jellicle
    Dec 10, 2017 at 19:52
  • Anyway, my real goal is to find when /bin/login was last called. It does not appear to show the time when I last logged in to my system.
    – Jellicle
    Dec 10, 2017 at 20:00

1 Answer 1

4

From Fstab pages:

atime options:

The atime options below can impact drive performance.

  1. The atime option means use kernel default value. As of kernel 2.3 or so, the kernel default is relatime. This option is not needed if defaults or relatime are specified.

  2. The strictatime option updates the access time of the files every time they are accessed. This is more purposeful when Linux is used for servers; it does not have much value for desktop use. The drawback about the strictatime option is that even reading a file from the page cache (reading from memory instead of the drive) will still result in a write!

  3. The noatime option fully disables writing file access times to the drive every time you read a file. This works well for almost all applications, except for those that need to know if a file has been read since the last time it was modified. The write time information to a file will continue to be updated anytime the file is written to with this option enabled.

  4. The nodiratime option disables the writing of file access times only for directories while other files still get access times written. Note: noatime implies nodiratime. You do not need to specify both.

  5. The relatime option is currently the kernel default value. It updates the access time only if the previous access time was earlier than the current modify or change time. In addition, since Linux 2.6.30, the access time is always updated if the previous access time was more than 24 hours old. This option is used when the defaults option or atime option are not specified.

  6. Kernel 4.0 and newer, the lazytime option reduces writes to disk by maintaining changes to inode timestamps (access, modification and creation times) only in memory. The on-disk timestamps are updated only when either:
    a) the file inode needs to be updated for some change unrelated to file timestamps,
    b) a sync to disk occurs,
    c) an undeleted inode is evicted from memory or
    d) if more than 24 hours passed since the the last time the in-memory copy was written to disk.

Thus you need:

UUID=334a0fe1-2636-4ee6-93b5-8748c5313c79 / ext4 strictatime,errors=remount-ro 0 1

If you have kernel 4.0 or newer, I would recommend adding 'lazytime` to increase performance and reduce drive writes:

UUID=334a0fe1-2636-4ee6-93b5-8748c5313c79 / ext4 strictatime,lazytime,errors=remount-ro 0 1

Sources:

https://wiki.archlinux.org/index.php/fstab
https://en.wikipedia.org/wiki/Stat_%28system_call%29#Solutions

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .