Journaling is supported in the Linux kernel with ext3. The ext3 file system is also fully compatible with the earlier ext2 version it replaces. To create an ext3 file system, you use the mkfs.ext3 command. You can even upgrade ext2 file systems to ext3 versions automatically, with no loss of data or change in partitions. This upgrade just adds a journal file to an ext2 file system and enables journaling on it, using the tune2fs command. Be sure to change the ext2 file type to ext3 in any corresponding /etc/fstab entries. The following example converts the ext2 file system on /dev/hda3 to an ext3 file system by adding a journal file (-j):
tune2fs -j /dev/hda3
The ext3 file system maintains full metadata recovery support (directory tree recovery), but it offers various levels of file data recovery. In effect, you are trading off less file data recovery for more speed. The ext3 file system supports three options: writeback, ordered, and journal. The default option, writeback, provides only metadata recovery, no file data recovery. The ordered option supports limited file data recovery, and the journal option provides for full file data recovery. Any files in the process of being changed during a crash will be recovered. To specify a ext3 option, use the data option in the mount command:
mount -t ext3 data=ordered /dev/sdla /mydata
Was this article helpful?