Why use EXT3 file system?

Don’t Want to Lose Data? Use ext3 File System.

 

Your computer has to live with fear of data loss and file system corruption when eventuality such as power failure or system crashes occurs. Not any more, if it uses new file system- ext3 in Linux. It looks like promising news that is capable to induce sound sleep in your mind. Isn’t it? But before you quickly march ahead to convert your existing file system to ext3 file system, better understand that how it helps you in not losing data at any mishap—even at the incident of hardware failure!

 

File system

When computer systems first designed to read and write chunks of data from storage media, it has been tough task to put data in order so that it can be retrieved later without any corruption. The data are stored in storage media as organised blocks identified as files, directories and free space.  To facilitate this task, numerous types of file systems were designed. New file systems are devised to add functionality or to eliminate limitations of existing file system. Maintaining consistency of the data that are stored in files and directories on present day’s huge storage media is real tough task for any file system since the data is expanding everyday with no boundary. File systems of earlier time tend to get corrupt due to silliest of reasons leaving users in frustrated state, but the situation has been changed and present file system such as ext3 are evolving as robust system. Some file system scanners/checkers/fixers utilities were also designed such as Microsoft’s Scandisk and Linux fsck that you have seen working fruitlessly when you lose data in sudden system crash or power failure. More over, these are designed to help you in running back your computer and application again at the expense of data loss. When a computer is booted, it first checks the integrity and consistency of available file system, and if it finds unclean file system then that part of file system is not available for use till the error is resolved.

Data Loss

Every file system are rigorously tested and debugged in simulated environment for all kinds of mishaps, and ways and means of immunization are designed for minimal loss. File systems like NTFS and ext2/ext3 uses some extremely clever algorithms for writing data to disk that largely eliminate file system corruption caused by running applications or the Operating System kernel itself, but eliminating data corruption and loss due to power outages and other system mishaps are still to be resolved effectively. In Linux, each and every file system is mounted during the boot process. During this process, a bit in the file system header is cleared, which indicates that the file system is in use and that the data structures used to manage allocation and file and directory organization in that file system is intact. This file system will remain consistent when all data blocks in the file system are either used or free and each allocated data block is claimed by one and only one file or directory, and all the files and directories can be access by crossing a series of other directories in the file system. When you properly shut down your Linux system, all file systems are unmounted prior to shut down of system. Unmounting a file system during a standard shutdown sets the clean bit in the file system header, indicating that the file system was cleanly umounted and is consistent. If the Linux system is not properly shut down such as on power failure or on system crashes, the clean bit in file system header is not set which indicates that the file system is not clean and need to be cleaned by utilities like fsck/e2fsck in order to make them usable again. However, when data and directory structure were being written at abrupt shutdown, data loss and system failure may occur that may not be recovered. Further, running fsck takes time, even hours if you have large amount of files and directories in your file system.

<adsense> 

Journaling file systems

            Data loss and file system corruption can be checked if you keep track the changes that are being made to the file system and log it before they are actually applied. These logs are stored in a separate part of the file system referred as journal or log. Once these journal records are safely written, a journaling file system applies those changes to the file system and then purges those entries from the log. Journaling file systems optimize file system consistency because log records are written before file system changes are made, and the file system saves these records till they have been safely and completely applied to the file system. When rebooting a computer that uses journaling file systems, the mount program can guarantee the consistency of the file system by simply checking the log for pending changes that are not marked as being done and applying them to the file system. The computer using journaling file systems is available almost instantly after rebooting since it need not have to check file system consistency during boot up. The chances of losing data due to file system consistency problems are reduced with an improved system speed.  

The ext3 file system

There are number of journaling file systems available for Linux. But presently, the file system that can deliver most is ext3 file system.  The ext3 file system is a journaling version of the Linux ext2 file system. The ext3 is fully compatible with the ext2 file system. The ext3 file system does not require a file system check even after an unclean system shutdown, except for certain rare hardware failure cases such as hard drive failures, because the data is written to disk in such a way that the file system is always consistent. The time to recover an ext3 file system after an unclean system shutdown does not depend on the size of the file system or the number of files; rather, it depends on the size of the "journal" used to maintain consistency. The ext3 file system is supported in Linux kernel versions 2.4.16 and above. It may be activated using the File systems Configuration dialog while building the kernel. Linux distributions such as Red Hat 7.2 and SuSE 7.3 and above include built-in support for the ext3 file system. You can only use the ext3 file system if ext3 support is compiled into your kernel and you have the latest versions of the mount and e2fsprogs Linux utilities. The ext3 file system also offers three different types of journaling, which you can activate in the /etc/fstab entry for an ext3 file system. The three journaling modes are following:

Journal – This mode logs all file system data and metadata changes. This is the slowest of the three ext3 journaling modes but minimizes the chance of losing the changes you made to any file in an ext3 file system. In this mode, losing data and damage to file system is extremely rare. This mode requires that an ext3 file system write every change to a file system twice - once to the journal, and then again to the file system itself. This can reduce the overall performance of your file system, but then it is the most reliable mode because it minimizes the chances of losing changes to your files since both metadata and data updates are recorded in the ext3 journal and can be exactly replayed when a system reboots.

Ordered – Ordered mode logs changes to file system metadata, but flushes file data updates to disk before making changes to associated file system metadata. In Ordered mode, only file system metadata changes are logged, which reduces redundancy between writing to the file system and to the journal and is therefore faster. Though the changes to file data are not logged, they are done before associated file system metadata changes are made by the ext3 journaling daemon, which can slightly reduce the performance of your system. However, using this journaling mode guarantees that files in the file system will never be out of sync with any related changes to file system metadata. This is the default setting in ext3 journaling mode and is recommended for most users.

Writeback – Writeback mode only logs changes to file system metadata and use standard file system write process to write file data changes to disk. Writeback mode is faster than the other two ext3 journaling modes because it only logs changes to file system metadata and does not wait for associated changes to file data to be written before updating things like file size and directory information.  In the event of system failure, you may lose some data, but your file system will remain intact. However, your files in file system may show some inconsistencies such as owning data blocks to which updated data was not yet written when the system suddenly went down.

If you have ext2 file system and want to convert it to ext3, then you need a file system conversion utility called tune2fs. The following command will do the rest for you.

# /sbin/tune2fs -j /dev/hdb1

You can specify the desired journaling mode to be used by an ext3 file system in /etc/fstab file. A typical entry for writeback option is listed below:

/dev/hdb1      /opt            ext3       data=writeback        1 0

 

Here, the option 0 is used to disable file checking utility fsck during boot process. You can replace data=writeback with default that is ordered mode. Here, in both cases, the fixed disk is hdb1, where your ext3 file system is, and for every such system, separate command and entries are required.

Other advantages

            Despite writing some data more than once, ext3 is faster than ext2 because ext3's journaling mode optimizes hard drive head motion. As has been discussed earlier, you can choose from three journaling modes to optimize for speed or to optimize for data integrity. The writeback mode limits the data integrity guarantee by allowing old data to show up in files after a crash, for a potential increase in system speed under some circumstances. The ordered mode, guarantees that the data is consistent with the file system means recently-written files will never show up with garbage contents after a crash. The journal mode requires a larger journal and therefore takes longer to recover in case of unclean shutdown, but is sometimes faster and reliable for certain database operations

The ext3 file system has wide cross-platform compatibility. It is available on 32 and 64 bit architectures, including many Unix clones and variants, BeOS, and Windows etc; which are capable of accessing files on an ext2 file system. Further, ext3 supports multiple journaling modes means you can configure it to write file data and metadata in any order giving you the full administrative control of its file system.

Box Item

So how many file system do you happen to know? Refresh your list with file system listed below (there are many more!)

  • DOS FAT 12
  • DOS FAT 16
  • Dr DOS
  • NEC MS-DOS 3.x
  • DOS EXTENDED (LBA VFAT)
  • Commodore DOS
  • BIGDOS /FAT 16 (LBA VFAT)
  • Hidden DOS FAT 12 & 16
  • Windows 95 FAT 32
  • Windows 95 FAT 32 (LBA)
  • Windows NTFS
  • AST Windows SWAP
  • OS/2 HPFS
  • OS/2 Boot Manager
  • Xenix Root & Xenix /Usr
  • QNX
  • Advanced UNIX , UNIX SysV/386 and 386/ix
  • AIX Bootable & AIX Data
  • DELL Multi-drive
  • Coherent File and Swap
  • OPUS
  • Compaq Diagnostics
  • Reliable System FTFS
  • Willowtech Photon COS
  • Willowsoft OFS1
  • The OS
  • VENIX 80286
  • PERSONAL RISC BOOT
  • SFS (By Peter Gutmen)
  • Novel
  • CP/M
  • Microport System v/386
  • EZ – Drive
  • Speed Stor
  • Mach, MtXinu
  • GNU HURD
  • Novell Netware
  • PC /IX
  • Minix
  • Linux Native, Linux Swap, ext2fs, ext3fs, xiafs, Linux Extended
  • Mitac
  • Solaris
  • Amoeba
  • Phoenix
  • Free BSD
  • BSDI
  • Syrinx
  • CTOS
  • Storage Dimensions
  • BeOS
  • LANstep
  • IBM PS/2 IML
  • And many more…

No comments: