Saturday, December 8, 2007

How to Change Mount Options at Runtime

File systems need to be mounted on Linux before you can access the data on them. You can specify mount options such as whether the file system is Read Only or Read/Write, and whether to support Access Control List, etc.

To see what file systems are currently mounted, where, and with what options, issue the mount command without arguments:
$ mount
/dev/hda5 on /home type ext3 (rw,acl)

Recently, I wanted to tell the file system not to track the last access time (atime) of files under /home. I did not have any good use for the last access time. So, I opted to disable its tracking to reduce disk activity and save a few watts. This is accomplished through adding the mount option noatime.

To change the mount option for /home:

  1. Edit /etc/fstab as root.
  2. Add the option noatime to the line that corresponds to /home:
    /dev/hda5 /home ext3    defaults,acl,noatime   0  2

  3. To make the change effective, you can either reboot (to which you sneer) or you can remount /home.

To remount a file system, say /home, with new mount options at run-time, issue a command like this:
$ mount -o  remount,noatime   /home

There you have it. You can now feel good about saving a few watts, and be the hero in saving the environment.

StumbleUpon Toolbar


Dilip Kumar said...

Whether the change in /etc/mtab file will effect permanently, i.e., even after rebooting the system?

Peter Leung said...


/etc/mtab is auto-maintained by the system, and lists the currently mounted devices. Do not edit it. Changes are not permanent.

You should be editing /etc/fstab which is persistent (even after rebooting).

Anonymous said...

Thanks, this saved me a great deal of work.