ext4 journaling optimization to reduce a disk load

If you check your disk usage you will see that jbd2 process writes some data to the disk every 5 seconds. This can be seen in iotop utility.

jbd2 is a part of ext4 journaling system. It synchronizes the filesystem and allows the system to quickly find damaged files after emergency shutdown.

This is an optional technology and it can be disabled. But it keeps the system clean and therefore in this note we will slightly optimize it for home station purposes.

jbd2 writes in higher priority, it is higher than user applications priority and therefore it can slow down the system performance, we will set it to the minimum value. Also the interval between “commits” is 5 seconds. We will expand it to 60 seconds that will reduce the disk access frequency and speed up the system I/O.

First, open /etc/fstab with root privileges with any text editor that you use. Here I use nano with -w option (disable line wrapping):

sudo nano -w /etc/fstab

Now find the line with the root filesystem mount options, it should look like this:

UUID=16701f96-ffff-429e-b6f1-3ab05cb8e584        /               ext4    noatime,errors=remount-ro        0       1

Add commit=60,journal_ioprio=7 after the other options. Be sure not to add extra spaces! – this can cause errors. The result should look like this:

UUID=16701f96-ffff-429e-b6f1-3ab05cb8e584       /               ext4    noatime,errors=remount-ro,commit=60,journal_ioprio=7          0       1

Save and quit. The changes will take effect after the system reboot.

Now about the options.

commit=60 sets the sync interval to 60 seconds (The default value is 5).

journal_ioprio=7 sets I/O priority to 7 (the lowest priority) when the journaling process writes. This parameter is from 0 to 7, where 0 is the highest priority. Default value is 3 which is slightly higher than the default I/O priority.

Additional options and its description is available on the man page:

man ext4

Leave a Reply

Your email address will not be published.