This post was originally published on August 25, 2009. The original can be found here.
Following from my last post about finalizing all of those small little choices I will now continue along that line but discuss the merits of the various filesystems that Linux allows me to choose from, as well as discuss how I am going to partition my drive.
Filesystem?
For a Windows or Mac user the filesystem is something they will probably never think about in their daily computing adventures. That is mostly because there really isn’t a choice in the matter. As a Windows user the only time I actually have to worry about the filesystem is when I’m formatting a USB drive. For my hard drives the choices are NTFS, NTFS, and.. oh yeah NTFS. My earliest recollection of what a filesystem is happened when my Windows 98 machine had crashed and I had to wait while the machine forced a filesystem check on the next start up. More recently FAT32 has gotten in my way with it’s 4GB file size limitation.
You mean we get a choice?
Linux seems to be all about choice so why would it be surprising that you don’t get to pick your own filesystem? The main contenders for this choice are ext2, ext3, ext4, ReiserFS, JFS, XFS, Btrfs and in special places Fat16, Fat32, NTFS, and swap.
Ext2
According to the great internet bible, ext2 stands for the second extended filesystem. It was designed as a practical replacement for the original, but very old, Linux filesystem. If I may make an analogy for Windows users, ext2 seems to be the Linux equivalent to Fat32, only much better. This filesystem is now considered mostly outdated and only really still used in places where journaling is not always appropriate; for example on USB drives. Ext2 can be used on the /boot partition and is supported by GRUB.
Ext2 Features
- Introduced: January 1993
- File allocation: bitmap (free space), table (metadata)
- Max file size: 16 GiB – 64 TiB
- Max number of files: 10^18
- Max filename length: 255 characters
- Max volume size: 2 TiB – 32 TiB
- Date range: December 14, 1901 – January 18, 2038
Ext 3
Ext3 is the successor to ext2 and removed quite a few of the limitations and also added a number of new features, most important of which was journaling. As you might have guessed it’s full name is the third extended filesystem. While ext3 is generally considered to be much better than ext2 there are a couple of problems with it. While ext3 does not have to scan itself after a crash, something that ext2 did have to do, it also does not have a an online defragmenter. Also because ext3 was primarily designed to shore up some of ext2’s faults, it is not the cleanest implementation and can actually have worse performance than ext2 in some situations. Ext3 is still the most popular Linux filesystem and is only now slowly being replaced by its own successor ext4. Ext3 can be used on the /boot partition and is fully supported by GRUB.
Ext3 Features
- Introduced: November 2001
- Directory contents: Table, hashed B-tree with dir_index enabled
- File allocation: bitmap (free space), table (metadata)
- Max file size: 16 GiB – 2 TiB
- Max number of files: Variable, allocated at creation time
- Max filename length: 255 characters
- Max volume size: 2 TiB – 16 TiB
- Date range: December 14, 1901 – January 18, 2038
Ext4
Ext4 is the next in the extended filesystem line and the successor to ext3. This addition proved to be quite controversial initially due to its implementation of delayed allocation which resulted in a very long time before writes. However ext4 achieves very fast read time thanks to this delayed allocation and overall it performs very well when compared to ext3. Ext4 is slowly taking over as the defacto filesystem and is actually already the default in many distributions (Fedora included). Ext4 cannot be used on the /boot partition because of GRUB, meaning a separate /boot partition with a different filesystem must be made.
Ext4 Features
- Introduced: October 21, 2008
- Directory contents: Linked list, hashed B-tree
- File allocation: Extents/Bitmap
- Max file size: 16 TiB
- Max number of files: 4 billion
- Max filename length: 256 characters
- Max volume size: 1 EiB
- Date range: December 14, 1901 – April 25, 2514
ReiserFS
Created by Hans ‘I didn’t murder my wife’ Reiser, in 2001 this filesystem was very promising for its performance but has since been mostly abandoned by the Linux community. It’s initial claim to fame was as the first journaling filesystem to be included within the Linux kernel. Carefully configured, ReiserFS can achieve 10 to 15x the performance of ext2 and ext3. ReiserFS can be used on the /boot partition and is supported by GRUB.
ReiserFS Features
- Introduced: 2001
- Directory contents: B+ tree
- File allocation: Bitmap
- Max file size: 8 TiB
- Max number of files: ~4 billion
- Max filename length: 4032 characters theoretically, 255 in practice
- Max volume size: 16 TiB
- Date range: December 14, 1901 – January 18, 2038
Journaled File System (JFS)
Developed by IBM, JFS sports many features and is very advanced for its time of release. Among these features are extents and compression. Though not as widely used as other filesystems, JFS is very stable, reliable and fast with low CPU overhead. JFS can be used on the /boot partition and is supported by GRUB.
JFS Features
- Introduced: 1990 and 1999
- Directory contents: B+ tree
- File allocation: Bitmap/extents
- Max file size: 4 PiB
- Max number of files: no limit
- Max filename length: 255 characters
- Max volume size: 32 PiB
XFS
Like JFS, XFS is one of the oldest and most refined journaling filesystems available on Linux. Unlike JFS, XFS supports many additional advanced features such as striped allocation to optimize RAID setups, delayed allocation to optimize disk data placement, sparse files, extended attributes, advanced I/O features, volume snapshots, online defragmentation, online resizing, native backup/restore and disk quotas. The only real downsides XFS suffers from are its inability to shrink partitions, a difficult to implement un-delete, and quite a bit of overhead when new directories are created and directories are deleted. XFS is supported by GRUB, and thus can be used as the /boot partition, but there are reports that it is not very stable.
XFS Features
- Introduced: 1994
- Directory contents: B+ tree
- File allocation: B+ tree
- Max file size: 8 EiB
- Max filename length: 255 characters
- Max volume size: 16 EiB
Btrfs
Btrfs, or “B-tree FS” or “Butter FS”, is a next generation filesystem will all of the bells and whistles. It is meant to fill the gap of lacking enterprise filesystems on Linux and is being spearheaded by Oracle. Wikipedia lists its new promised features as online balancing, subvolumes (separately-mountable filesystem roots), object-level (RAID-like) functionality, and user-defined transactions among other things. It’s stable version is currently being incorporated into mainstream Linux kernels.
Btrfs Features
- Introduced: 20xx
- Directory contents: B+ tree
- File allocation: extents
- Max file size: 16 EiB
- Max number of files: 2^64
- Max filename length: 255 characters
- Max volume size: 16 EiB
So what’s it all mean?
Well there you have it, a quick and concise rundown of the filesystem options for your mainstream Linux install. But what exactly does all of this mean? Well, as they say, a picture speaks a thousand words. Many people have done performance tests against the mainstream filesystems and many conclusions have been drawn as to what is the best in many different circumstances. As I assume most people would chose either XFS, ext3, ext4 or maybe even Btrs if they were a glutton for punishment I just happen to have found some interesting pictures to show off the comparison!
Rather than tell you which filesystem to pick I will simply point out a couple of links and tell you that while I think XFS is a very underrated filesystem I, like most people, will be going with ext4 simply because it is currently the best supported.
Links (some have pictures!):
EXT4, Btrfs, NILFS2 Performance Benchmarks
Filesystems (ext3, reiser, xfs, jfs) comparison on Debian Etch
Hey! You forgot about partitions!
No, I didn’t.
Yes you did!
OK, fine… So as Jon had pointed out in a previous post the Linux filesystem is broken down into a series of more or less standard mount points. The only requirements for Fedora, my distribution of choice, and many others are that at least these three partitions exist: /boot for holding the bootable kernels, / (root) for everything else, and a swap partition to move things in and out of RAM. I was thinking about creating a fourth /home partition but I gave up when I realized I didn’t know enough about Linux to determine a good partition size for that.
OK, so break it down
/boot
Fedora recommends that this partition is a minimum of 100MB in size. Even though kernels are each roughly 6MB in size it is better to be safe than sorry! Also because ext4 is not supported by GRUB I will be making this partition ext3.
LVM
I know what you’re thinking, what the hell is LVM? LVM stands for Logical Volume Manager and allows a single physical partition to hold many virtual partitions. I will be using LVM to store the remainder of my partitions wrapped inside of a physical encrypted partition. At least that’s the plan.
swap
Fedora recommends using the following formula to calculate how much swap space you need.
If M < 2
S = M *2
Else
S = M + 2
Where M is the amount of memory you have and S is the swap partition size in GiB. So for example the machine I am using for this experiment has 4 GiB of RAM. That translates to a swap partition of 6 GiB. If your machine only has 1 GiB of RAM then the formula would translate to 2 GiB worth of swap space. 6 GiB seems a bit overkill for a swap partition but what do I know?
/ (root)
And last but not least the most important part, the root partition. This partition will hold everything else and as such will be taking up the rest of my drive. On the advice of Fedora I am going to leave 10 GiB of LVM disk space unallocated for future use should the need arise. This translates to a root partition of about ~300 GiB, plenty of space. Again I will be formatting this partition using ext4.
Well there you go
Are you still with me? You certainly are a trooper! If you have any suggestions as to different disk configurations please let me know. I understand a lot of this in theory but if you have actual experience with this stuff I’d love to hear from you!
Leave a Reply