Choosing Linux File System


Choosing Linux File System

When choosing File system(disk file system) for Linux installation most of the users will choose default which will be XFS(on most modern Linux distributions), but there is quite a few of file systems available. Lets take a look at different Linux file systems and see what similarities and differences they have.

Unlike Windows Linux kernel supports many different types of filesystems. Linux can also read and write to Windows filesystems.

The Linux kernel interfaces with each filesystem using the Virtual File System (VFS). This provides a standard interface for the kernel to communicate with any type of filesystem. VFS caches information in memory as each filesystem is mounted and used.

What does disk filesystem do ?

  • Provides structure to the array of bits residing on the disk
  • File and directory naming and hierarchy
  • File access – open, read, write, seek, close
  • Knows how to map to
  • Tracks which sectors are used and which are “free”
  • Access control

Basic disk filesystem features

In this table you can see very basic features of disk file systems.

File System Max File Size Max Partition Size Journaling Additional Information
Fat16 2 GiB 2 GiB Not maintained
Fat32 4 GiB 8 TiB Not maintained
NTFS 2 TiB 256 TiB Yes Standard for Windows – supported on Linux
ext2 2 TiB 32 TiB Not well maintained
ext3 2 TiB 32 TiB Yes Standard linux filesystem
ext4 16 TiB 1 EiB Yes Standard linux filesystem
reiserFS 8 TiB 16 TiB Yes Not well maintained
JFS 4PiB 32PiB Yes Not well maintained
XFS 8 EiB 8 EiB Yes Best choice for a mix of stability and advanced journaling

Examples of Other typed of file systems

  • Network: nfs, cifs, afs, ceph, etc …
  • Memory: amfs, tmpfs, etc …
  • Pseudo: proc, sysfs, etc …
  • Stackable: ecryptfs, etc…
  • Object store: (exofs)

Quick compare ext2, ext3, ext4


  • This was developed to overcome the limitation of the original ext file system.
  • Ext2 does not have journaling feature.
  • On flash drives, usb drives, ext2 is recommended, as it doesn’t need to do the over head of journaling.
  • Maximum individual file size can be from 16 GB to 2 TB.
  • Overall ext2 file system size can be from 2 TB to 32 TB.


  • Introduces in Linux Kernel 2.4.15.
  • The main benefit of ext3 is that it allows journaling.
  • Maximum individual file size can be from 16 GB to 2 TB.
  • Overall ext3 file system size can be from 2 TB to 32 TB.
  • You can convert a ext2 file system to ext3 file system directly (without backup/restore).


  • Introduced in Linux Kernel 2.6.19.
  • Supports huge individual file size and overall file system size.
  • Maximum individual file size can be from 16 GB to 16 TB.
  • Overall maximum ext4 file system size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB (terabyte).
  • Directory can contain a maximum of 64,000 subdirectories (as opposed to 32,000 in ext3).
  • You can also mount an existing ext3 fs as ext4 fs (without having to upgrade it).
  • Several other new features are introduced in ext4: multiblock allocation, delayed allocation, journal checksum. fast fsck, etc.
  • In ext4, you also have the option of turning the journaling feature “off”.
A journaling filesystem is a filesystem that maintains a special file called a journal. This file can be used to repair any inconsistencies that occur as the result of an improper shutdown of a computer.

XFS disk file system

XFS file system was designed as Journaling filesystem that performs best when support needed for large files and large filesystems. XFS filesystem is currently default filesystem used for Red Hat. FS has a large number of features that make it suitable for enterprise-level computing in the environments where very large number of files and large file sized need to be supported

BTRFS disk file system

BTRFS is fairly new filesystem development for which started back in 2007. This filesystem will offer better scalability and reliability then ext4 and expected to replace it in the future. It is a journaling file system.

This filesystem currently considered as experimental and this is how it compares to the rest of modern filesystems.
Development started 2006 1994 2009
Max volume size 1Ebytes 8Ebytes 16Ebytes
Max file size 16 Tbytes 8 Ebytes 16 Ebytes
Transparent compression No No Yes
Attributes Yes Yes Yes
Snapshots No Planned Yes

Basic commands to create and upgrade filesystems

You will need have a portion created with fdisk or similar tool before creating file system

Create ext2 filesystem

mke2fs /dev/sda1

Create ext3 filesystem

mkfs.ext3 /dev/sda1

Create ext4 filesystem

mkfs.ext4 /dev/sda1
In convert examples we use /home partition as an example mounted on /dev/sda2

Convert from ext2 to ext3

umount /dev/sda2
tune2fs -j /dev/sda2
mount /dev/sda2 /home

Convert from ext3 to ext4

umount /dev/sda2
tune2fs -O extents,uninit_bg,dir_index /dev/sda2
e2fsck -pf /dev/sda2
mount /dev/sda2 /home

Performance with hundred thousands of small files

If you examine performance results below with many small files. You can see that best read results produces RaiserFS with ext4 good overall performance. XFS follows behind when working with many small files

Using Linux Kernel version 3.1.7
    create:    53 s
    rewrite:    6 s
    read sq:    4 s
    read rn:  312 s
    delete:   373 s

    create:    46 s
    rewrite:   18 s
    read sq:   29 s
    read rn:  272 s
    delete:    12 s

    create:    62 s
    rewrite:  321 s
    read sq:    6 s
    read rn:  246 s
    delete:    41 s

    create:    68 s
    rewrite:  430 s
    read sq:   37 s
    read rn:  367 s
    delete:    36 s

Performance with databases

We have done some in house benchmark performance testing with different filesystems like MariaDB, MySQL, Postgres. Although we will not publish full benchmarking results here in a nutchell basic tests show the following.

performed well


poor performance