Friday, November 7, 2014

High Performing Linux File System With EXT4 (Journal Off)

For virtualization purpose, we required a very high performing Linux file system (Host machine, Lubuntu 14.04 LTS Version). Earlier we'd tried with 'EXT2' file system, but not impressive enough.

Later we came to know that, 'EXT4' is the best file system for high performance and stability. As you would probably know, 'EXT4' is a journaling files system by default, which cost a bit on the performance front.

So if you' opt the below combination, you will get the ultimate file system performance, that will benefits your host machine, as well as guests (IO Performance)

1. Use EXT4 File System

2. Switch Off 'Journaling'

3. Enable "Write Back" mode

So, say you've your partition already formatted with 'EXT4' (It is with Journaling-On by default). Now from command line do the below operations to switch off 'Journal'.

Say for eg: Our EXT4 partition is '/dev/sda5'

# Enable writeback mode. Provides the best ext4 performance.
tune2fs -o journal_data_writeback /dev/sda5
# Delete journal option
tune2fs -O ^has_journal /dev/sda5

Now recheck the files system.

# Required fsck
e2fsck -f /dev/sda5

We're done! We can further optimize the performance with the below additional options with EXT4 (fstab opions: data=writeback, noatime, nodiratime)

/dev/sda5 /opt ext4 defaults,data=writeback,noatime,nodiratime 0 0

Ok. the above is applicable, if we already have a 'EXT4' files system.

What if we've an EXT2 file system, that we need to make it as a 'EXT4' with the above options? Just convert it to EXT4 first (using the below command) and perform the above.
# /dev/sda5 disk (Change EXT2 to ext4)
mkfs.ext4 /dev/sda5

Hope, this might be useful for someone having similar experiments!

No comments:

Post a Comment