Using ext3

Put simply, the ext3 file system is just ext2 with the journaling feature added to it. Therefore, ext3 is completely compatible with ext2. As compared to other journaling file systems, however, using ext3 has some important disadvantages. Most of them are because ext3 uses tables for storing information about the files, not a B-tree database, which is the case in ReiserFS and XFS file systems. Because these tables have to be created and are accessed in a linear way, working with ext3 is slow when dealing with large volumes or large amounts of data. The most significant disadvantages of using ext3 are as follows:

• It takes ages to format a large ext3 file system.

• ext3 is not good at handling large amounts of small files in the same directory.

• ext3 has no option to create new inodes after the file system has been created. This creates the possibility that free disk space is still available but cannot be used because no inodes are available to address that disk space.

The most important time to use ext3 is when you want to convert an existing ext2 file system to a journaling file system. This is easy; the next steps describe how to do it:

1. Make a complete backup of the file system you want to convert.

2. Use the tune2fs program to add a journal to a mounted or unmounted ext2 file system. If you want to do this on /dev/sdb1, use tune2fs -j /dev/sdb1. After creating the journal, a file with the name .journal will be created on the mounted file system. This file indicates the conversion was successful.

3. Change the entry in /etc/fstab where your file system is mounted. Normally, it would be set to the ext2 file system type; now, change the type to ext3.

4. Reboot your server, and verify that the file system was mounted successfully.

The most important item in an ext3 file system is the journal, and you can use this journal in different ways. You specify these journaling options when mounting the file system. Before I discuss these options, though, you need to know how data is written to a hard drive. In each write of files, two different kinds of information need to be written: first the data blocks and then the metadata of a file. The metadata includes all the administrative information about the file; basically, you can think of the information that is displayed when using ls -l (but some more information is added as well). When tuning an ext3 journal, you can specify whether both metadata and blocks need to be journaled or whether just the metadata needs to be written to the journal.

The following options are available; you can activate them by using mount -t ext3 -o data=xxxx /yourdevice /yourmountpoint:

data=journal: With this option, both the data and the metadata of the file that is written are written to the journal. This is the safest but also the slowest option.

data=ordered: With this option, only the file's metadata is journaled. However, before updating the metadata with information about the changed file, a data write is forced. This ensures file system consistency with minimal performance impact.

data=writeback: Only metadata is written to the journal, and nothing happens to the data blocks. This is a rather insecure option where you have a serious risk of corruption of the file system.

In short, ext3 is not the best file system you can use. This is basically because it is built upon a file system that dates from a period where a 120MB hard disk was considered huge. ext3 is not able to handle the needs of current large files and file systems efficiently. Therefore, I recommend not using it and using ReiserFS or XFS instead.

Was this article helpful?

0 0

Post a comment