LinuxFilesystemsExplained

Revision 1 as of 2005-05-28 20:44:07

Clear message

Linux Filesystems Explained

Filesystems are one of the things any newcomer to linux must become acquainted with. In the world of Microsoft you never really have to worry about it, the default being FAT32 or with the newest version of Windows, NTFS. Linux however, being built on a world of of open source and differing opinions, is not limited in this way and so the user should have an understanding of what a filesystem is and how it affects the computer.

At the core of a computer, it's all 1s and 0s, but the organization of that data is not quite as simple. A bit is a 1 or a 0, a byte is composed of 8 bits, a kilobyte is 1024 bytes, a megabyte being 1024 kilobytes and so on and so forth.

A hard drive stores all your data, any time you save a file, you're writing thousands of 1s and 0s to a metallic disc, literall pricking it and creating an indentation that can later be read as 1 or 0.

There is so much data on a hard drive that there has to be some way to organize it, like a library of books and the old card drawers that indexed all of them, without that index, we'd be lost. Libraries, for the most part, use the Dewey Decimal System to organize their books, but there exist other systems to do so, none of which have attained the same fame as Mr. Dewey's invention.

Filesystems are the same way. The ones most users are aware of are the ones Windows uses, the vFat or the NTFS systems, these are the Windows default filesystems.

There are several different attributes which are necessary in defining file systems, these include their max file size, max partition size, whether they journal or not.

Now let me talk about journalling for a moment. A journalling file system is more reliable when it comes to data storage. I explained earlier about what it actually meant when you saved a file, it meant you were prodding a metal disc to create 1s and 0s, but what if in the middle of writing you had a power failure and so the file you saved didn't finish saving? You end up with corrupted data.

A journalling system works to prevent that from happening by instead of actually writing immediately directly to the part of the disk where the file is stored, it writes it to another part of the hard drive and notes the necessary changes to a log, then in the background it goes through each entry to the journal and begins to complete the task, and when the task is complete, it checks it off on the list.

So how does this prevent the loss of data? Well you click save for foo.txt, the computer then writes the file to a different part of the hard drive and writes it to the journal. Then when it arrives at the front of the queue it begins writing it to the proper location on the hard drive. Then the power goes off. Well when it turns back on, you still have the pristine file in the journal, so it begins writing it again and overwriting the now corrupt data. And if perhaps the power died while writing to the journal, you still have the previous version of the file saved in pristine condition.

Now below is a very brief comparison of the most common file systems in use with the Linux world.

File System Name

Max File Size

Max Partition Size

Journalling?

Notes

Fat16

2 Gb

2 Gb

No

Fat32

4 Gb

128 Gb

No

NTFS

Hardware limited

2 Tb

No

Linux can only read this, it is incapable of writing to it at the time of this writing.

ext2

2 Tb

4 Tb

No

ext3

2 Tb

4 Tb

Yes

ext3 is essentially ext2 with journalling support

reiserFS

8 Tb

16 Tb

Yes

Tb = Terabyte (1024 gigabytes) :: Gb = Gigabyte (1024 Megabytes)

Above you'll see a brief comparison of two main attributes of different filesystems, the max file size and the largest a partition of that data can be.

Of the above filesystems the only one you cannot install Linux on is the NTFS.

(more to come)

Links for more information: