Tuesday, March 3, 2009

Boost Your Disk Performance by Using Journal Data Writeback Mode of Ext3

boost your ext3 filesystem by using data=writeback mode
As of now Ext3 has been the default filesystem and Journal Data Ordered has been its default mode. Of course, Ext4 has already been included in kernel 2.6.28, but most of us are using Ext3 till we make a big leap in a year or two. So, let's make the best of it while we can.

Ext3 has 3 journaling modes:

1. Journal Data
2. Journal Data Ordered
3. Journal Data Writeback

Most Linux distros by default use mode 2 of Ext3, that is much safer though less faster. We can use mode 3, i.e., Data Writeback to improve with a little tradeoff of safety. In this mode you might loose some recent data in case of a crash. But as a home user there is less chance of such events.
Let's get on to the task.

Open Konsole and be a super user.

Code:

su

Modify /etc/fstab

Code:

nano /etc/fstab

Modify mounted partition by adding data=writeback

Code:

# Pluggable devices are handled by uDev, they are not in fstab
/dev/sda1 / ext3 defaults,noatime,data=writeback 1 1
proc /proc proc defaults 0 0
devpts /dev/pts devpts mode=0622 0 0
/dev/sda3 /home auto defaults,noatime,data=writeback 1 2
# Dynamic entries below
/dev/sda2 swap swap sw,pri=1 0 0
/dev/cdrom /media/cdrom udf,iso9660 noauto,users,exec,ro 0 0
/dev/hda /media/cdrom udf,iso9660 noauto,users,exec,ro 0 0

Modify /boot/grub/menu.lst file.

Code:

nano /boot/grub/menu.lst

Add data=writeback the way mentioned below

Code:

timeout 0
color cyan/blue white/blue
foreground ffffff
background 0639a1

gfxmenu /boot/grub/message

title MEPIS at sda1, newest kernel
root (hd0,0)
kernel /boot/vmlinuz root=/dev/sda1 data=writeback nomce quiet splash vga=791
initrd /boot/initrd.img
boot

title MEPIS at sda1, kernel 2.6.27-1-mepis-smp
root (hd0,0)
kernel /boot/vmlinuz-2.6.27-1-mepis-smp root=/dev/sda1 data=writeback nomce quiet splash vga=791 /mnt/mepis/boot/grub/menu.lst
boot

Now change journaling mode of Ext3 in your disk partitions manually to writeback

Code:

tune2fs -o journal_data_writeback /dev/sda1
tune2fs -o journal_data_writeback /dev/sda3


Now check your filesystem.

Code:

tune2fs -l /dev/sda1

You will see journal_data_writeback applied to your default mount options. Please click on the image to see it in its true size.

boost your ext3 filesystem by using data=writeback mode

And finally, reboot your system.

6 comments:

Anonymous said...

Why reboot after changing mount parameters? this is linux, not windoze, right?

Unknown said...

Nice article, good howto. What it is MISSING is howto recover if it does not work and the user finds himself (like I did) not being able to boot into X. Thankfully, a LiveCD works to repair the damage.

Don't get me wrong; I've been reading your posted blogs for a while now and appreciate them. However, sometimes tips and tricks don't work, so its nice if you also post the directions for backing them out when disaster strikes! :)

regards,
-dc

manmath sahu said...

ken, in future i will definitely write how to get back to the previous state.

thanks for posting the comment.

Anonymous said...

Your blog keeps getting better and better! Your older articles are not as good as newer ones you have a lot more creativity and originality now keep it up!

Unknown said...

Thank you for your sharing. I want to post quickly but I do not know the way. Your article helps me, thank you so much
SEO Company India

Unknown said...

The message is just very ample! Thanks!
SEO Company in Delhi

How about this