Pick a Free OS

User login

Navigation

The Second Extended File System - An introduction

Now let us have a look at some of the utilities in the ext2fsprogs package that is provided with a standard Linux distribution.

* e2fsck:

This program allows us to perform a file system check on a volume that is based on the Ext2 file system. It is like Scandisk for Windows, only much more effective. Here, we can specify a filename to which it will attach all the badblocks. It is flexible enough to allow the user to specify the superblock, if any alternate one is present. Block size for the file system, in case we have compiled the filesystem driver to handle a different block size, can be specified too.

Caution: Never run e2fsck/fsck on any filesystem that is mounted. If we wish to run ‘fsck’, we should ‘unmount’ the filesystem, and then perform an ‘fsck’. Failing to do the above may cause the filesystem to be corrupted.

* tune2fs:

This allows us to tune filesystem parameters to customized settings. Here, we can set the maximum mount count between two filesystem checks, volume label, error behavior, change the reserved information and many other parameters. This utility should be used only when we are sure of what we are doing to the filesystem.

* dumpe2fs:

This program dumps the status of the ext2 file system specified as a parameter to the standard output device. It is useful for analyzing problems as well as accessing general information about the usage of the filesystem. One of the most useful utilities for an ext2-based filesystem.

* mke2fs:

This program allows us to create an ext2 filesystem on a previously unformatted volume. It provides a plethora of options ranging from block size, fragment-size, bytes-per-inode to various RAID options. In its own way, it is one of the most flexible of ext2fs utilities. ‘mke2fs’ is usually run during fresh installation, where new root and other filesystems are being constructed. It should not be run without expert knowledge of the consequences.

* badblocks:

This program searches the disk to check for blocks that have been damaged. It is usually run before installing packages on a new file system or volume. It is advisable to not run this program on a mounted filesystem.

The Second Extended Filesystem of Linux is a state-based file system. It maintains the state of all open files in memory. All files that are opened for any kind of access, have entries in data structures in memory. These data structures maintain the current status of the files loaded from disk to memory. Dirty blocks are identified by entries in these data structures and these can be explicitly written to disk using the ‘bdflush’ command.