Mount options for a faster ext4

Here’s a line from /etc/fstab on one of my machines (for a non-SSD partition):

UUID={...} / ext4 noatime,data=writeback,barrier=0,nobh,errors=remount-ro 1 1

Here’s why:

  1. I don’t need to enable barriers for a fixed disk on a battery-backed laptop. (See the mount manpage for how a barrier works. There is a small risk associated.)
  2. The data=writeback option results in only metadata being journaled, but not actual file data. This does engender the risk of corrupting recently modified files in the event of a sudden failure. But if you’re willing to run with it, it provides a great boost to the filesystem’s performance.
  3. noatime disables the atime (access timestamp) feature, which would otherwise cause additional writes to record timestamps for every time an inode is accessed. You can safely enable this.
  4. nobh prevents association of buffer heads with data pagefiles (Only works with data=writeback).
    The big impact options are nos. 2 and 3, whereas you can play it a bit safer by ignoring nos. 1 and 4.