Home > linux, tools > fsck Alternatives

fsck Alternatives

We’ve all been there. Our Linux system crashing unexpectedly either by loss of power, you tripping on power cord, your cat or 2 year old son tripping on power cord etc. The end result is your PC shutting off and caught completely by surprise.

Perhaps a better analogy is you’re Linux box quietly humming along, reading some news, browsing around while taking a nice long crap…all of a sudden, someone, in this case you, your cat or some other external force push it off the toilet while it was about to drop the biggest crap of all.

You surprised the heck out of it and made it crap on itself instead of the toilet and now it’s a big mess. This the case when your server unexpectedly crashes and you have to clean up the mess before it can boot up cleanly again.

fsck command is the most common way of dealing with such issues, however it can really test your patience by taking the longest time to recover a disk/partition, not recover at first try or at all, continuous bad syntax and so much frustration. Thankfully Linux has 4 other major filesystems available for production and they’re called journaling filesystems. A journaling file system is a file system that logs changes to a journal (usually a circular log in a specially-allocated area) before actually writing them to the main file system.

A journaled file system maintains a journal of the changes it intends to make. In case of disruption, recovery involves reading the journal and replaying to restore consistency and ultimately making the recovery process much easier and more efficient. Journaling results in massively reduced time spent recovering a filesystem after a crash, and is therefore in high demand in environments where high availability is important, not only to improve recovery times on single machines but also to allow a crashed machine’s filesystem to be recovered on another machine when we have a cluster of nodes with a shared disk. Below is a list of a few major journaling filesystems that you can implement.

XFS

XFS is the oldest journaling file system available for UNIX systems, and has a mature, stable and well-debugged codebase. It a high-performance journaling file system. It provides quick recovery after a crash, fast transactions, high scalability, and excellent bandwidth. XFS provides journaling for file system metadata, where file system updates are first written to a serial journal before the actual disk blocks are updated. The journal is a circular buffer of disk blocks that is never read in normal filesystem operation.

It can be stored within the data section of the filesystem (an internal log), or on a separate device to minimise disk contention. On XFS the journal contains ‘logical’ entries that describe at a high level what operations are being performed, as opposed to other filesystems with ‘physical’ journals that store a copy of the blocks modified during each transaction. Journal updates are performed asynchronously to avoid incurring a performance penalty. In the event of a system crash, operations immediately prior to the crash can be redone using data in the journal, which allows XFS to guarantee file system consistency. Recovery is performed automatically at file system mount time, and the recovery speed is independent of the size of the file system. Where recently modified data has not been flushed to disk before a system crash, XFS ensures that any unwritten data blocks are zeroed on reboot, obviating any possible security issues arising from residual data.

ReiserFS

ReiserFS stores file metadata (“stat items”), directory entries (“directory items”), inode block lists (“indirect items”), and tails of files (“direct items”) in a single, combined B+ tree keyed by a universal object ID. Disk blocks allocated to nodes of the tree are “formatted internal blocks”. Blocks for leaf nodes (in which items are packed end-to-end) are “formatted leaf blocks”. All other blocks are “unformatted blocks” containing file contents. Directory items with too many entries or indirect items which are too long to fit into a node spill over into the right leaf neighbour. Block allocation is tracked by free space bitmaps in fixed locations.

By contrast, ext2 and other Berkeley FFS-like file systems simply use a fixed formula for computing inode locations, hence limiting the number of files they may contain.[9] Most such file systems also store directories as simple lists of entries, which makes directory lookups and updates linear time operations and degrades performance on very large directories. The single B+ tree design in ReiserFS avoids both of these problems due to better scalability properties.

JFS

IBM’s JFS is a journaling filesystem used in its enterprise servers. It was designed for “high-throughput server environments, key to running intranet and other high-performance e-business file servers” according to IBM’s Web site.

EXT3

Ext3 adds journaling filesystem capabilities to ext2fs. An alternative for all those who do not want to switch their filesystem, but require journaling capabilities. It is distributed in the form of a kernel patch and provides full backward compatibility. It also allows the conversion of an ext2fs partition without reformatting and a reverse conversion to ext2fs, if desired.

Resources:

* Linux XFS: http://oss.sgi.com/projects/xfs
* ReiserFS: http://www.namesys.com
* JFS for Linux: http://oss.software.ibm.com/jfs
* Ext3: http://www.zipworld.com.au/~akpm/linux/ext3

References:

* http://en.wikipedia.org/wiki/Journaling_file_system
* http://en.wikipedia.org/wiki/XFS
* http://en.wikipedia.org/wiki/Ext3
* http://en.wikipedia.org/wiki/IBM_Journaled_File_System_2_%28JFS2%29
* http://en.wikipedia.org/wiki/ReiserFS

Categories: linux, tools Tags:
  1. January 22nd, 2010 at 19:04 | #1

    Hi,

    you should definitely look at the free (as in beer, not as in open) version of veritas storage foundation.
    while it is _extremely_ challenging due to its amount of features, it is the most robust, fastest, and cool-ish-est filesystem available on linux – plus it comes with a far more powerful volume manager than standard lvm.

    i can’t even describe how much sleep it has saved me at work since the majority of systems has been migrated from dm-multipath/lvm/ext3 to veritas.

    It might seem overkill for a normal home fileserver, but to be honest, I think the learning / setup time pay off tenfold by having less to worry about.

  1. March 31st, 2010 at 21:16 | #1