site  contact  subhomenews

Change ext4 journal commit interval from 5 to 30

June 21, 2020 — BarryK

I have been examining why EasyOS has almost continuous writes to the hard drive, even when "doing nothing" on the desktop, and eliminated writes by pmcputemp:

The ext4 journal remains as the single biggest contributor. We could go back to not using a journal, but instead will try some other solutions to reduce writes. One possibility is to change the commit interval from the default 5 seconds.

I have modified the 'init' script in the initrd to change it to 30 seconds:

 if [ "${WKG_FS}" == "ext4" ];then #200621 change journal commit interval from 5 to 30...
#rw,relatime,data=ordered are the defaults anyway...
mount -t ${WKG_FS} -o commit=30,rw,relatime,data=ordered /dev/$WKG_DEV /mnt/$WKG_DEV
mount -t ${WKG_FS} /dev/${WKG_DEV} /mnt/${WKG_DEV}

That will also result in faster operation, though if there is a crash then you lose the last 30 seconds of your work. Hmmm, maybe we could even make that a longer time? Trying this for the next release of EasyOS, see how it goes. 

Tags: easy