Navigation Bar

Linux File Systems

What is a file system? A file system basically organises data on a disk into files and directories and gives each file a name, which must be unique in each directory. It usually associates access permissions with each file too. More sophisticated file systems have facilities to recover data from system crashes.
You do not need to define file systems, it is possible to define and access disks as 'raw' partitions and in fact some database applications claim to prefer raw disks, but most users and applications require a file system to be able to store data.
Linux has its own file systems like ext2 and reiser, but it is unusual because it has a virtual file system layer. That allows it to support file systems developed for other operating systems, such as Windows FAT and NTFS and UNIX JFS

Simple File Systems

ext2

The Linux default file system is ext2. It can support partitions of up to 4 Terabytes in size and single files up to 2 Gigabytes. However you may not achieve these full sizes as some Linux kernels only will only support 2TB partitions. A Linux filename can be up to 255 characters long.

As it is a simple file system ext2 has no automated recovery from system crashes, but it has an e2fsck command which you would run to check the validity of the file system after a crash. This program also runs automatically once every so many boot-ups to check out the file system, even if the system was correctly shut down.

With the ext2 file system you can undelete files which were deleted by mistake. This is not the same as the Windows "recycle bin" which simply moves deleted files to a different folder for a while. When a file is physically deleted the directory entry is removed but the underlying data remains intact on the disk until it is overwritten. An ext2 undelete will check to see if the data still exists and will replace the directory entry if the data is intact. The ext2 file system also has a "secure deletion" which will delete the underlying data if that is a compliance requirement, or it can mark files so they cannot be updated, or can only have data appended to them.

Windows Systems

Linux also supports Windows FAT16 and FAT32 and OS/2 simple file space partitions. This would typically be used to share files between Linux and Windows. Some Linux implementations will also support Windows NTFS in read only mode

Journalled file systems

If the power fails on a computer, or if it is shutdown by simply switching the power off, then it is possible that data on the disk has been corrupted, as some of the data may have been written out, and some not. With a simple file system, the disks must be checked for errors after a failure using a 'scandisk' or 'fdisk' utility. A journalled file system avoids this problem by initially writing updates to a journal file on the disk, then writing out the data to the file areas as a background task. Once these writes are successful the updates are marked as complete and the journal deleted. If the system crashes then on reboot the journal area is scanned for pending updates and these are written out to the disk, without the requirement to scan the entire file system.

ext3

Ext3 is essentially ext2 with journaling support. There are three types of journaling

Journal
Both metadata and file contents are written to the journal before they are written to disk. Secure but has a performance overhead as all the data is written out twice
Writeback
Just the metadata is journalled, so it is faster, but the data writes could be written out in the wrong order, which could corrupt the end of a file after a crash.
Ordered
Just the metadata is journalled, but each data component must be written out successfully before the metadata is committed. This forces the data writes to be in order. Ordered is faster than Journal and more secure than writeback so it is usually the default journaling scheme.

It is fully backwards compatible with ext2, ext2 partitions can be converted to ext3 and vice-versa without reformatting the partition and an ext3 partition can be mounted by an older kernel with no ext3 support - it is just seen as a normal ext2 partition. Also ext3 partitions allow files to be undeleted. Ext3 supports on-line filespace resizing, but it does not have a defragmentation facility nor can deleted files be recovered is it zeroes out inodes when a file is deleted.

ReiserFS

ReiserFS was introduced with version 2.4.1 of the Linux kernel and was the first journaling file system available for Linux. It was developed by Hans Reiser and uses a balanced tree structure instead of the traditional i-file block based structure. As well as introducing journaling, ReiserFS is designed to be much faster than ext2, and the later versions allow the file system to be expanded online, and also to shrink offline.

It is generally considered to be reliable, be space efficient and deliver good performance. It does not have a defragmentation facility, though this is thought to be superfluous as the files are stored in a balanced tree format.

ReiserFS is supplied as the default filesystem for many implementations of linux, including SuSE, Xandros, Yoper, Linspire, Kurumin Linux, FTOSX and Libranet Linux distributions.

XFS

Silicon Graphics originally developed XFS for its own IRIX servers, It can handle file sizes of millions of Terabytes and was originally designed for high performance applications like computer graphics. It uses a B+ tree a bit like ReiserFS but has a lot of flexibility in the type of data it can store in each file.

JFS

Linux supports the IBM JFS file system as developed for AIX UNIX

Samba

The samba.org website answers the question “what is SAMBA” as; “Samba is software that can be run on a platform other than Microsoft Windows, for example, UNIX, Linux, IBM System 390, OpenVMS, and other operating systems. Samba uses the TCP/IP protocol that is installed on the host server. When correctly configured, it allows that host to interact with a Microsoft Windows client or server as if it is a Windows file and print server”

So Samba runs on Linux platforms but can speak to Windows clients like a native Windows server. It basically allows Windows clients to access a Linux server's file space and printers through the Server Message Block (SMB) and Common Internet Filesystem (CIFS) protocols.

Conclusion

So which is the best file system for Linux? That is probably an emotive question and any answer will upset devotees of the missing file systems, so here goes.

Use ext2 or ext3 for the Linux boot or root partition. As these are the native Linux file systems you are less likely to have problems with them in an emergency situation.

Use one consistent journalled file system for all other partitions. If you must have best performance use RieserFS, if you want to store advanced security attributes use XFS, but ext3 will work well in most situations and is compatible with the root partition. Use LVM for everything except the root partition.

back to top


By entering and using this site, you accept the conditions and limitations of use