| Lesson 3
| Ext2 configuration, part 2
| Use tune2fs, dumpe2fs, and debugfs to optimize and configure the ext2 filesystem.
Red Hat Ext2 File System
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
-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.
Other filesystem Parameters
In addition to using
to set maximum mount count, you can use it to update other filesystem parameters on Linux ext2 filesystems
, such as error behavior, reserved blocks count or percentage, and the number of users and groups that can use the reserved blocks.
tune2fs [ -l ]
[ -c max-mount-counts ]
[ -e errors-behavior ] [ -f ]
[ -i interval-between-checks ] [ -j ] [ -J journal-options ]
[ -m reserved-blocks-percentage ]
[ -o [^]mount-options[,...] ] [ -r reserved-blocks-count ]
[ -s sparse-super-flag ]
[ -u user ] [ -g group ] [ -C mount-count ]
[ -E extended-options ] [ -L volume-name ]
[ -M last-mounted-directory ] [ -O [^]feature[,...] ]
[ -T time-last-checked ] [ -U UUID ] device
tune2fs allows the system administrator to adjust various tunable filesystem parameters on Linux ext2, ext3, or ext4 filesystems.
The current values of these options can be displayed by using the -l option to tune2fs(8) program, or by using the dumpe2fs(8) program.
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.
Unmounting root Partition in Red Hat
If you wish to unmount your root partition and modify the filesystem parameters, get rescue software for Linux.
Use the rescue software, then use
to make the modifications.
To detach a previously mounted file system, use either of the following variants of the umount command:
- umount directory
- umount device
When a file system is in use (for example, when a process is reading a file on this file system), running the umount command will fail with an error.
To determine which processes are accessing the file system, use the fuser command in the following form:
fuser -m directory
For example, to list the processes that are accessing a file system mounted to the /media/cdrom/ directory, type:
~]$ fuser -m /media/cdrom /media/cdrom: 1793 2013 2022 2435 10532c 10672c
How do I unmount root partition in Red Hat?
In Red Hat, the umount command is used to unmount a file system from the file hierarchy. To unmount a root partition, you will first need to log in as the root user or use sudo to execute the command with administrator privileges. Here is the basic syntax of the command to unmount the root partition:
For example, if the root partition is located at /dev/sda1, you would run the following command:
Execute while system is running
It is important to note that you should not unmount the root partition while the system is running and actively using it, as this could cause data loss or system crashes. If you want to change the partition while the system is running, you should use other tools like lvm and resize2fs to change size of the partition. Before unmounting the root partition, it's a good practice to check whether the partition is in use or not by using command
lsof | grep /path/to/root/partition
Also, you may want to unmount other filesystems which are mounted on the root partition before unmounting it.
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:
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
For more information about ext2fs tools, see the
Enter the command to debug the /dev/hdb2 filesystem.
The next lesson discusses the use of the automounter.
Red Hat Linux Certification
adjust tunable filesystem parameters on ext2/ext3/ext4 filesystems.