| Author |
Message |
|
|
Post subject: ext3 tweaks
Posted: Aug 17, 2007 - 10:33 PM
|
|

Joined: Dec 01, 2006
Posts: 751
Status: Offline
|
|
All examples use /dev/sda1, but you can change it to whatever you want (/dev/sda2, /dev/sdb1337 (that doesn't even work does it?), I really don't care)
tune2fs command can be run on mounted ext3 volumes.
All the tweaks online tell you to configure fstab and grub. They are stupid.
All it takes is a command by tune2fs.
Journals
ext3 has 3 journal modes, Data, Ordered, and Writeback (slowest to fastest)
Quick overview:
data commits all data to the journal prior to writing to the main filesystem.
ordered commits all data directly to the main filesystem before writing metadata to the journal.
writeback as it's name suggests writes data to the main filesystem after committing metadata to the journal.
Check the manual for tune2fs for more detailed information.
Example:
Code:
tune2fs -o journal_data_writeback /dev/sda1
This added journal_data_writeback to the default ext3 mount options for that partition. So if ext3 is mounted without options saying otherwise, or specifically with the option 'defaults', it will use writeback.
To get rid of that option, just add ^ before the option
Code:
tune2fs -o ^journal_data_writeback /dev/sda1
Just remember not to have two journal options as default.
Note: the writeback journal is not very reliable and you may lose important data in a power outage. Check the man page of tune2fs for more information.
Reserved blocks percentage
According to the manual, reserved blocks are designed to keep your system from failing when you run out of space. Its reserves space for privileged processes such as daemons that start during init 3 and the reserved space can also prevent the filesystem from fragmenting as it fills up.
On large partitions such as 300gb, however, the default 5% reserved space can be 15gb, which is quite a lot of space.
You can use the following command to reduce it to 3%, which is a bit more logical on larger filesystems.
Code:
tune2fs -m3 /dev/sda1
Remember, you don't want to remove the reserved blocks entirely, just reduce it to gain back unused space for unprivileged data.
dir_index: Use hashed b-trees to speed up lookups in large directories.
You can enable it with this command.
Code:
tune2fs -O dir_index /dev/sda1
Thats not enough however, you must run e2fsck on the partition with the -D parameter to optimize the directories for dir_index.
To do this, you must unmount it, or remount as read only. If you are using the partition and can't unmount it, switch to init 1 and run
Code:
umount /dev/sda1
If this is your root partition, this will remount it as read only - otherwise it will be completely unmounted. You can then proceed to running
Code:
fsck -Df /dev/sda1
and then
Code:
reboot
fsck timers
ext3 disk checks are long and usually uneventful. By default ext3 is scheduled for a full disk check quite often (about 32 mounts or a few weeks to a few months, based on how often you reboot your system).
Time dependent fsck flags generally are less reliable, you can reset your CMOS on your bios or a power outage might mess with it. It's just too easy to change the time and completely void the persistence of the time based fscking.
To disable time dependent fscking, you would run something like this:
Code:
tune2fs -i0 /dev/sda1
number of mounts is more accurate, so there is no need to change the defaults (32), but if you did, this would be an example for 100 mounts.
Code:
tune2fs -c100 /dev/sda1
check ext3 configuration
The configuration of an ext* partition can be checked with the -l (L) switch.
Code:
tune2fs -l /dev/sda1
Hope you guys find this useful! |
Last edited by damentz on Nov 29, 2008 - 12:10 AM; edited 10 times in total
|
| |
|
|
|
 |
|
|
Post subject: RE: ext3 tweaks
Posted: Aug 17, 2007 - 11:06 PM
|
|
Joined: Nov 28, 2006
Posts: 4303
Status: Offline
|
|
good information, I'm going to check out the reserved blocks percentage, that seems totally high, for large disks, especially large data disks that you watch to make sure they don't fill up anyway. That could easily be 1 or 2% I think. Space is absolute, not relative, so if say 5% is enough for 4gig drive, then clearly 1% would be enough, more than enough actually, for a 300 gig drive.
Actually, looking at man, I see that there's another option:
-r reserved-blocks-count
which might also be interesting.
I've noticed that large space being consumed, I'll give this a look see and check to see what differences it makes.
If there are any known gotchas or issues with these methods, please let this thread know, could be interesting. |
_________________ sidux Maintenance script: dist-upgrade, kernel install, general utilities: smxi
Backup script [using rdiff-backup]: rd-h2.sh
|
| |
|
|
|
 |
|
|
Post subject: RE: ext3 tweaks
Posted: Aug 18, 2007 - 12:03 AM
|
|

Joined: Dec 01, 2006
Posts: 751
Status: Offline
|
|
| Thanks, I just had to write down all this stuff in a logical manner, everyone else seems to suck at documenting tweaks. |
_________________ "Cool was never cool until the cool guys at Cool industries developed a cool new product: Cool."
|
| |
|
|
|
 |
|
|
Post subject: RE: ext3 tweaks
Posted: Aug 18, 2007 - 12:43 AM
|
|
Joined: Aug 09, 2007
Posts: 41
Location: Auckland, New Zealand
Status: Offline
|
|
| "tune2fs -m3 /dev/sda1" ... should be done on an unmount disk right? ... or are you saying that it's okay to do it on a mounted disk? I would have thought that the other tune2fs commands should be done on an unmounted disk too?? |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: ext3 tweaks
Posted: Aug 18, 2007 - 12:55 AM
|
|

Joined: Nov 30, 2006
Posts: 3481
Location: Budapest
Status: Offline
|
|
I think I always did tune2fs-commands on monted filesystems. Ususally I just hate the check after 30 mounts, which is 10 years on Debian Stable. Never got a complaint doing "tune2fs -c 1000" on a Desktop. ext3 is solid, not giving itself up like I experienced with ReiserFS (gosh ... and it was really fast ...).
hubi |
_________________ Bonitas stultitiaque sodales sunt.
|
| |
|
|
|
 |
|
|
Post subject: RE: ext3 tweaks
Posted: Aug 18, 2007 - 01:05 AM
|
|
Joined: Aug 09, 2007
Posts: 41
Location: Auckland, New Zealand
Status: Offline
|
|
Ahhhh thx hubi  |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: ext3 tweaks
Posted: Aug 18, 2007 - 01:29 AM
|
|

Joined: Dec 01, 2006
Posts: 751
Status: Offline
|
|
| OH! Ya let me make this clear and add in hubi's thing. |
_________________ "Cool was never cool until the cool guys at Cool industries developed a cool new product: Cool."
|
| |
|
|
|
 |
|
|
Post subject: RE: ext3 tweaks
Posted: Aug 18, 2007 - 02:00 AM
|
|
Joined: Dec 02, 2006
Posts: 169
Location: Hawaii
Status: Offline
|
|
Love that -c 1000 tweak! Due to high electric costs ($.35/kwh) my box is up and down many times per day. 30 mounts comes pretty quick. tnx!
Paul |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: ext3 tweaks
Posted: Aug 20, 2007 - 10:32 PM
|
|

Joined: Dec 01, 2006
Posts: 751
Status: Offline
|
|
| Can this go into general support? It would look nice with the reiserfs vs ext3 recommendation. |
_________________ "Cool was never cool until the cool guys at Cool industries developed a cool new product: Cool."
|
| |
|
|
|
 |
|
|
Post subject: RE: ext3 tweaks
Posted: Aug 21, 2007 - 12:25 AM
|
|
Joined: Nov 28, 2006
Posts: 4303
Status: Offline
|
|
| Sure, makes sense, it is after all a general topic, and I think, because sidux will really only actively support ext3, it makes sense to have a decent reference thread for it. |
_________________ sidux Maintenance script: dist-upgrade, kernel install, general utilities: smxi
Backup script [using rdiff-backup]: rd-h2.sh
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Feb 02, 2008 - 12:11 PM
|
|
Joined: Nov 12, 2007
Posts: 328
|
|
Is there a possibility to see which options have been applied to a partition?
How can I see which journal mode has been enabled or whether I have 2 journals, what is mount-count now, etc.?
I didnt find this in 'man tune2fs'.
Where can I see, what 'defaults' in fstab really means? I didnt find anything about it in 'man fstab'.
cas |
_________________ sidux-2007-04 Ερως kde-full
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Feb 02, 2008 - 02:54 PM
|
|

Joined: Dec 02, 2006
Posts: 45
Location: Stuttgart
Status: Offline
|
|
|
|
|
 |
|
|
Post subject:
Posted: Feb 03, 2008 - 02:31 AM
|
|
Joined: Nov 12, 2007
Posts: 328
|
|
thank you, john
about 'defaults', it is in 'man mount'.
cas |
_________________ sidux-2007-04 Ερως kde-full
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Mar 23, 2008 - 01:06 AM
|
|
Joined: Nov 12, 2007
Posts: 328
|
|
|
|
|
 |
|
|
Post subject:
Posted: Mar 23, 2008 - 02:09 AM
|
|

Joined: Nov 30, 2006
Posts: 3481
Location: Budapest
Status: Offline
|
|
|
|
|
 |
|
|