Exploring the ext3 Filesystem - page 4
Introduction to the ext3 Filesystem
The ext3 filesystem is a journaling version of the Linux ext2 filesystem. The ext3 filesystem has one significant advantage that no other journaling filesystem has - it is totally compatible with the ext2 filesystem. It can therefore make use of all of the existing applications that have already been developed to manipulate and fine-tune the ext2 filesystem. The ext3 filesystem is supported in Linux kernel versions 2.4.16 and newer, but must be activated using the Filesystems Configuration dialog when building the kernel. Linux distributions such as Red Hat 7.2 and SuSE 7.3 already include built-in support for the ext3 filesystem. You can only use the ext3 filesystem if ext3 support is compiled into your kernel and you have the latest versions of the mount and e2fsprogs Linux utilities.
In most cases, converting filesystems from one format to another involves backing up all of the data that they contain, reformatting the partition or logical volume that contains the filesystem, and then restoring all of the previous data to that filesystem. Due to the compatibility between the ext2 and ext3 filesystems, this sort of conversion process is totally unnecessary when converting and ext2 filesystem to ext3, which can be done (as root) with a single command:
# /sbin/tune2fs -j
As an example, converting the ext2 filesystem located on the partition /dev/hda5 to an ext3 filesystem would be done with the following command:
# /sbin/tune2fs -j /dev/hda5
The tune2fs command's -j option creates the ext3 journal on an existing ext2 filesystem. After converting an ext2 filesystem to ext3, you must also update the entries in the /etc/fstab file for that filesystem to specify that it is an ext3 filesystem. You can also use the "auto" filesystem type option, but I prefer to explicitly identify the type of filesystem that I'm using. The following examples from an /etc/fstab file show before and after versions of the entry for a filesystem on /dev/hda5:
/dev/hda5 /opt ext2 defaults 1 2
/dev/hda5 /opt ext3 defaults 1 0
The last field of a Linux /etc/fstab entry specifies the stage in the boot process during which filesystem consistency should be verified by the "fsck" program. When using the ext3 filesystem, you can set this field to "0", as shown in the previous example. This means that the fsck program will never check the consistency of the filesystem, since the consistency of the filesystem is guaranteed by playing back the journal.
Converting the root filesystem of a Linux system to ext3 requires some special handling, and is best done in single user mode after creating an initial RAM disk that supports the ext3 filesystem.