To start off, I will tell you a bit about atime. Basically it writes to the file you have done anything with, whether it's creating it, modifying it, or reading it. This can cause slowdowns cause it makes the disk spin more than it needs to. So what we want to do is simply turn it off. This way when you open a file, it will not write the atime, saving you from having your disk spin (more than necessary). This is great if you have USB linux distributions installed, as it will minimize writing to the disk, saving the USB disk. If the prospect of noatime is too much for you, inserting relatime will be a good option. This way, it only writes to atime if permissions (chmod/grp) or last write is later than the atime currently recorded. So basically, if you open a file, close it, and open it again, it wouldn't adjust atime.
Another note, cause the examples are long they may go to the next line. If this is the case, use the code copy and place it in a text editor without line-wrap on. This will give you the proper view then.
Now to dig into the how to.
First, switch to a root terminal with
- Code: Select all
sudo su
We're going to keep using the root terminal, so don't exit it.
Next we edit the fstab.
- Code: Select all
cp /etc/fstab /etc/fstab.bak
gedit /etc/fstab
It should look something like this:
- Code: Select all
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/sda1 / ext4 errors=remount-ro 0 1
/dev/sda3 /home ext4 defaults 0 2
/dev/sda2 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
Now anytime you see an ext4, change the types, add (for ext3 change it to barrier=0):
- Code: Select all
noatime,data=writeback,commit=60,nobarrier
to it. I will demonstrate so you know where to stick it.
- Code: Select all
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/sda1 / ext4 errors=remount-ro,noatime,data=writeback,commit=60,nobarrier 0 1
/dev/sda3 /home ext4 defaults,noatime,data=writeback,commit=60,nobarrier 0 2
/dev/sda2 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
Save it and close gedit.
Make sure that when you add ,noatime,data=writeback,commit=60,nobarrier that there are no spaces in between the comma and the option. This will not work otherwise, and I don't know if/how much it could screw your PC up.
Now we're almost done, but don't forget to add this last step, or you could render your OS unbootable. In the root terminal:
- Code: Select all
tune2fs -o journal_data_writeback /dev/sdxx
and replace xx with the disk number.
For instance, since I did this to partition 1 and 3, I would have to do
- Code: Select all
tune2fs -o journal_data_writeback /dev/sda1
tune2fs -o journal_data_writeback /dev/sda3
And finally, if you want to keep the partition in the future but install another distro on it, make sure you use
- Code: Select all
sudo tune2fs -o journal_data_ordered /dev/sdxx
on those partitions to turn them back to normal.
Thanks for reading and good luck!







