Sat, February 10, 2018 · 1 min read

Optimizing ext4 performance in fedora 26

Optimizing ext4 performance in fedora 26

My fstab entries:

[root@server ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Sat Feb  3 11:35:29 2018
#
UUID=01c7c465-b326-453a-9769-e7727eaa47d7 / ext4 noatime,nobh,nobarrier,commit=60,data=writeback,relatime,errors=remount-ro 0 0
  1. Add the settings to fstab then check the syntax:
[root@server ~]# mount -a
  1. Reboot the OS. It will boot into read-only file system. Don’t panic.
[root@server ~]# touch test
touch: cannot touch 'test': Read-only file system
  1. Check if the device has journaling. If it is enabled, that caused read-only file system while booting.
[root@server ~]# tune2fs -l /dev/sda3 | fgrep has_journal
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
  1. Making required changes:
[root@server ~]# sudo tune2fs -o journal_data_writeback /dev/sda3
tune2fs 1.43.4 (31-Jan-2017)
[root@server ~]# tune2fs -O ^has_journal /dev/sda3
  1. Check fstab:
[root@server ~]# mount -a
[root@server ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Sat Feb  3 11:35:29 2018
#
UUID=01c7c465-b326-453a-9769-e7727eaa47d7 / ext4 noatime,nobh,nobarrier,commit=60,data=writeback,relatime,errors=remount-ro 0 0
UUID=f0e9431d-ff9f-4d4d-9b21-8194c79e336c /boot ext4 defaults 1 2
UUID=ae23eb2a-ff04-478b-abf1-e297641dc26f swap swap defaults 0 0
UUID=e9480814-7c11-4ed1-956a-ab46610c5079 /media/data ext4 defaults 0 0
  1. Reboot.

  2. Check the disk write speeds with dd:

[cipher@server ~]$ sudo dd if=/dev/zero of=store6 bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB, 1000 MiB) copied, 3.06385 s, 342 MB/s