Filesystem Administration  «Prev  Next»

Lesson 3 Ext2 configuration, part 2
Objective Use tune2fs, dumpe2fs, and debugfs to optimize and configure the ext2 filesystem.

tune2fs

Use the tune2fs command with the -c option to reduce the number of system checks. Typically after twenty mounts, an ext2 filesystem gets a forced system check. In the past, this was a wise precaution to fix errors before they affected filesystem performance or availability.
However, large partitions take several minutes to perform a check, which means the filesystem isn't available for use during this time With today's less error-prone hardware, frequent checks are not as necessary.
The tune2fs command's -c option allows you to set the maximum number of mounts, called the mount count, before a check is enforced. The e2fsck program, which normally checks filesystems at boot, will check the actual number of mounts against the maximum mount count. If the mount count exceeds the maximum, then e2fsck will intensively check the filesystem. If any errors were detected, but not automatically corrected, you should use the filesystem debugging utilities outlined below to fix the problems.
Do not use tune2fs on a mounted filesystem! Unmount the filesystem first, then update the parameters. Modifying active filesystems will cause complications, and possibly even the loss of the filesystem.

dumpe2fs and debugfs


If errors were encountered during the e2fsck check, use the command dumpe2fs to show the filesystem's state. dumpe2fs, as the name suggests, provides a dump of information about a filesystem. This information can provide clues as to what the exact problem is, which you will need to correct manually. To use this command, provide the filesystem as its first parameter--for example: dumpe2fs /dev/hda5.
debugfs provides an interactive, text-based interface that allows you to correct filesystem errors manually. It provides a rich set of examination, diagnostic, and modification commands. Like dumpe2fs, provide the filesystem to debug as its first parameter, as in debugfs /dev/hda5. For more information about ext2fs tools, see the
Question: Enter the command to debug the /dev/hdb2 filesystem.
Answer: debugfs /dev/hdb2
The next lesson discusses the use of the automounter.