File systems are one of the layers beneath your operating system that you don’t think about—unless you’re faced with the plethora of options in Linux. Here’s how to make an educated decision on which file system to use.
The landscape of the Linux file system support is drastically different from Windows and OS X. In Windows and OS X you can find software that will add support for non-standard file systems, but both operating systems can only be installed on their native file system and third party support is added after the fact.
Linux on the other hand has a vast array of supported file systems built into the kernel. But how are you supposed to know which file system to pick when installing? We will take a look at some of the most popular choices available and give you use cases to consider—the choice is ultimately up to you based on your needs.
What is Journaling?Before we go to far down the rabbit hole talking about options, we need to first take a quick look at journaling. The only real thing you need to know about journaling is that every modern file system uses journaling in some form or another and on any desktop or laptop you are setting up with Linux you will want to use a journaling file system.
Journaling is only used when writing to a disk and it acts as a sort of punch clock for all writes. This fixes the problem of disk corruption when things are written to the hard drive and then the computer crashes or power is lost. Without a journal the operating system would have no way to know if the file was completely written to disk.
With a journal the file is first written to the journal, punch-in, and then the journal writes the file to disk when ready. Once it has successfully written to the disk, it is removed from the journal, punch-out, and the operation is complete. If power is lost while being written to disk the file system can check the journal for all operations that have not yet been completed and remember where it left off.
The biggest downside to journaling is that it sacrifices some performance in exchange for stability. There is more overhead to write a file to disk but file systems get around this overhead by not writing the full file to the journal. Instead only the file metadata, inode, or disk location is recorded before actually being written to disk.
File System OptionsAs we look at some of the major file systems available to Linux we are going to touch briefly on each on and give a couple suggestions on when you may or may not want to use the file system based on features. This in no way means these file systems cannot be used in other cases, these suggestions are just areas where each file system will excel.
Ext stands for Extended file system and was the first created specifically for Linux. It has had four revisions and each one has added fairly significant features. The first version of Ext was a major upgrade from the Minix file system used at the time, but it lacks major features used in today’s computing.
- At this time you probably should not use Ext in any machine due to its limitation and age. It also is no longer supported in many distributions.
- Due to lower write requirements, and hence lower erases, it is ideal for flash memory especially on USB flash drives.
- Modern SSDs have a increased life span and additional features that can negate the need for using a non-journaling file systems.
- Use if you need to upgrade a previous Ext2 file system to have journaling.
- You will probably get the best database performance from Ext3 due to years of optimizations.
- Not the best choice for file servers because it lacks disk snapshots and file recovery is very difficult if deleted.
Ext4 reduces file fragmentation, allows for larger volumes and files, and employs delayed allocation which helps with flash memory life as well as fragmentation. Although it is used in other file systems, delayed allocation has potential for data loss and has come under some scrutiny.
- A better choice for SSDs than Ext3 and improves on general performance over both previous Ext versions. If this is your distro’s default supported file system, you should probably stick with it for any desktop or laptop you set up.
- It also shows promising performance numbers for database servers, but hasn’t been around as long as Ext3.
BtrFS, pronounced “Butter” or “Better” FS, is being developed by Oracle and contains similar features found in ReiserFS. It stants for B-Tree File System and allows for drive pooling, on the fly snapshots, transparent compression, and online defragmentation. It is being specifically designed for enterprises but most every consumer distro has plans to move to it as the default file system eventually.
Although it’s not stable in some distros, it will eventually be the default replacement for Ext4 and currently offers on-the-fly conversion from Ext3/4. It is also key to note that the principle developer for ext3/4, Theodore Ts’o, has said that BtrFS is the “way forward”.
- BtrFS makes a great server file system due to it’s performance, snapshots, and many other features.
- Oracle is also working on a replacement for NFS and CIFS called CRFS which boasts better performance and more features. Making it the best choice for a file server.
- The performance tests have shown it to lag behind Ext4 on flash memory such as SSDs, as a database server, and even certain cases of general system read/writes.
- Ubuntu 10.10 only allows you to install BtrFS if you use the text base alternate install CD and your /boot partition still requires an Ext file system.
- Has great performance for small files such as logs and is suited for databases and email servers.
- ReiserFS can be dynamically expanded but not shrunk and does not support FS level encryption.
- The future of Reiser4 is questionable and BtrFS is probably a better choice.
XFS was developed by Silicon Graphics in 1994 for their own operating system and was later ported to Linux in 2001. It is comparable to Ext4 is some regards because it also uses delayed allocation to help with file fragmentation and does not allow for mounted snapshots. XFS has shown itself to provide good performance with large files and has the ability to be resized, however you are not able to shrink an XFS volume.
- Good for a media file server because of constant throughput for large files.
- Most distributions require separate /boot partition because XFS and GRUB can be unpredictable
- Performance with small files is not as good as other file systems making it a poor choice for databases, email, and other servers that have a lot of logs.
- Not as well supported as Ext for personal computers and doesn’t have significant performance improvements or features over Ext3/4.
JFS was developed by IBM in 1990 and later ported to Linux. It boasts low CPU usage and good performance for both large and small files. JFS partitions can be dynamically resized but not shrunk like ReiserFS and XFS. It was extremely well planned and has support in most every major distribution, however its production testing on Linux servers isn’t as extensive as Ext as it was designed for AIX.
- Good performance for both large and small files and because of its low CPU usage is probably best for low powered servers and computers
- It does not have built in tools for drive pooling so it may not be as expandable as something like BtrFS but a netbook with only 1 hard drive may be a good option
- It also has fast disk checking compared to Ext but there have been some reports of disk corruption after long term use.
ZFS is worth a mention because it is also be being developed by Oracle and has similar features to Btrfs and ReiserFS. It was in the news in recent years when Apple was rumored to move to it as their default file system. Due to its licensing, Sun CDDL, it is not compatible to be included in the Linux kernel. It does however have support through Linux’s Filesystem in Userspace (FUSE) which makes using ZFS possible.
- Shows great performance in large disk arrays.
- Supports a lot of advanced features including drive pooling, snapshots, and dynamic disk striping.
- It may be difficult to install in Linux because it requires FUSE and might not be supported by your distribution.
To learn even more you can check out the Wikipedia page on comparison of file systems.
So Which One Should You Choose?For a general use case on your laptop or desktop, you’ll probably want to stick with ext4 (if your distro uses it as the default), since it’s a modern file system that’s supported in most distributions—but if you’ve got a specific need, now you have more information to make your decision.
So now that you understand the differences between the file systems, which one would you choose?