BTRFS (spelled “butter fs”) is the promising next generation filesystem(fs) for linux. A linux user has many filesystems to choose from right now, ext2/3, reiserfs, XFS, JFS to name some. Currently the most used file system for linux is clearly ext3. Being the successor of ext2, and sharing many data structures for the sake of backwards compatibility, those two share many disadvantages as well.
Fsck is a tool that checks the consistency of a file system. Currently there is no possibility for ext3 to do this while being mounted(online). We all know the bad timed fscks on a startup. It has some good algorithms to avoid fragmentation, therefor this will not be a problem for most users, though in the long term, or for server environments, it might become a problem. However there is no possibility to do a defragmentation, neither on nor offline. In contrast to ext2, it is a journaling file system. That means changes to the filesystem will be logged before being committed. Another disatvantage is that ext3 is not well know for being fast, instead it is rather slow compared to other filesystems.[1] On the other side ext3 is really well known, well tested and rock stable.
There is an successor of ext3, too. Ext4 is yet under development and should not be used productively. It tries to overcome some of the disadvantages of it’s antecessor. Both forward and backward compatibility shall be given. Though the backward compatibility can be broken, through mount options, in order to use the feature of extents. Furthermore it brings tools for online defragmentation with it and improves the performance.[1] The jounarl will have it’s own checksums, which avoids corruption of the filesystem through inconsistencies in the journal. As it will be released before btrfs, it will fill the gap in between. According to Phoronix Ubuntu 9.04, which will be released in April, will include the support for ext4.[6]
Btrfs has been integrated in the current linux kernel that is being developed, 2.6.29. Although there existed some issue concerning the API, and other things. It has been announced back in 12 Jun 2007 on the lkml, initiated by the Oracle employee Chris Mason.[4]
Even though it is in the kernel now, it will take quite some time until the average user can take advantage of it. Btrfs is a copy-on-write filesystem, which brings the feature of snapshots with it. That means if you copy something, the physical data for that file is only present once, unless you change one of the files. Not until you do that the data will be copied. This is really usefull, when you want to store a specific state of your filesystem, whilst continuing to work on it normally, without copying a large amount of data, e.g. when doing a backup. Through heavy snapshot usage the need for a journal disappears.
Moreover it will be possible to check the filesystem online, that means no more fsck on startup is needed(but yet possible). Furthermore there will be checksums both for data and metadata. Ext3 does lack checksumming in the journal. Inodes will be allocated dynamically, instead of a fixed count of inodes. SSD become more and more popular, and will be used commonly when the stable btrfs is released, therefor a special mount option will be present that optimizes the filesystem for the usage for those. A complete list of features can be found in the LKML[4] and the btrfs wiki[3]. Btrfs can be seen as the linux answer to Sun’s ZFS, which can’t be used within the kernel, because of the incompatibility of the used open source license to the GPL. Btrfs brings features that a modern filesystem should not miss, yet it will take it’s time to be stabalized. Until then ext4 will probably the choice for most.
Resources:
- Phoronix file system bechnmark
- LWN Article: A better btrfs
- btrfs wiki
- LKML anncouncement
- Ted Ts’o on the LKML about btrfs
- Phoronix: Ubuntu 9.04 supports ext4