Tip of the Trade: With the tune2fs command you can set assorted filesystem parameters on a mounted ext2 or ext3 filesystem.
command allows you to set assorted filesystem parameters on a mounted ext2 or ext3 filesystem. The basic syntax is:device
will be something like /dev/hda1
. Here are a couple of useful options to try out.
- -c max-mount-counts enables you to change the number of
mounts that trigger an automatic e2fsck check. To turn checking
off altogether, use -1 or 0 – but use this with extreme caution!
More useful is setting the value to different numbers for different
partitions, so that you will not have every partition checked on the same
- -j adds an ext3 journal to the filesystem, enabling you to
journalize your non-journaled ext2 filesystems on the fly. The
-J option sets journal parameters – you can change the
journal size, or use an external device for the journal, e.g. if your
existing filesystem is full). Since the journal file created is
immutable, the file will be moved to a special inode next time you reboot.
However, if you're editing the root filesystem, you may need to run
e2fsck from a rescue floppy, as the root FS is mounted read-only
on boot. (Some systems, including Debian, have a workaround for
- -O options sets mount options and/or filesystem features for
the system. If you set -O sparse_super, this limits the number
of backup superblocks and can save some space in really large filesystems.
For large directories, -O dir_index uses hashed b-trees to speed
up directory lookups. Set more than one option at the same time by using
a comma (no space!) between options. For example, -O
dir_index,sparse_super for that giant filesystem with the big
This article was originally published on Tuesday Jan 20th 2009