NILFS2 – Whats all the buzz about?
NILFS2 is an acronym for “New Implementation of a Log-Structured File System Version 2”. This file system is one of the two new file systems, along with EXOFS, that was incorporated in the recently released Linux Kernel 2.6.30.
According to the kernel documentation,
NILFS is a new implementation of a log-structured file system (LFS) supporting continuous snapshotting. In addition to versioning capability of the entire file system, users can even restore files mistakenly overwritten or destroyed just a few seconds ago. Since NILFS can keep consistency like conventional LFS, it achieves quick recovery after system crashes.
Let me break down what, it says:
- NILFS is a log-structured file system(LFS). Log-Structured File system is the file system in which files (data and metadata) are written sequentially in a continuous stream, called log, just like the way entries are made in a logbook, as opposed to the spread-out fashion utilized in conventional file systems, which are tree based. The log-structured file system offers several advantages over a tree based (read conventional) system.
- NILFS2 supports continuous snapshotting. Snapshots of a file system is, just like the snapshots we take with a camera, a record of the state of the file system at a certain point of time. Snapshotting is a natural part of any log-structured file system. However, what NILFS2 is capable of is that this snapshotting can be done continuously without any interruption to service. This is in contrast to other file systems supporting snapshotting, like ZFS, which have to suspend operation to take snapshots. There number of snapshots that can be stored is limited only by the space available.
- NILFS2 has versioning capacity. This is basically refering to the various snapshots that can be taken of the file system, which can also be interpreted as versions of the file system.
- Restore files mistakenly overwritten or destroyed just a few seconds ago. This is because the system saves a checkpoint of the filesystem every few seconds or per synchronous write basis. So, even when a file has been deleted, it can still be restored from the last checkpoint.
- NILFS2 achieves quick recovery after system crash. This is typical of all log-structured file systems. The time trequired for a log-structured file systems recover from a crash is independent of the size of the volume.
Some other features of NILFS2, in addition to that mentioned above, that deserves mention are:
- Any number of snapshots can be mounted alongside the primary file system as a read-only system.
- Being log-structured, NILF2 has very fast write persormance.
- NILFS2 provides a big increase in performance with SSD (Solid State Drive). However this comes at a price that we shall see below.
On the other hand, NILFS2 still has a few issues.
- Because of the Garbage Collection algorithm implemented, NILFS2 tends to be very write heavy. This will affect the life of a SSD as it has a limited write cycle.
- NILFS2 does not have a built-in RAID.
In spite of these few issues NILFS2 is still a very exciting filesystem to look out for. With an intelligent Garbage Collection algorithm, it is expected that the issue with SSD can be sorted out. As of now, it is a very solid file system for HDD.