LinuxFilesystemsExplained

Differences between revisions 6 and 7
Revision 6 as of 2006-01-09 18:35:30
Size: 4873
Editor: 63-230-106-150
Comment: fixed errors: how HDDs work and journaled FSs, NTFS is journaled
Revision 7 as of 2006-06-19 16:06:39
Size: 69
Editor: 127
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
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 (i.e. 2^10^) bytes, a megabyte is 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, changing the magnetic properties 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.

A journaling file system is more reliable when it comes to data storage. Journaling filesystems do not necessarily prevent corruption, but they do prevent inconsistency and are much faster at filesystem checks than non-journaled FSs. If a power failure happens while you are saving a file, the save will not complete and you end up with corrupted data and an inconsistent FS. Instead of actually writing directly to the part of the disk where the file is stored, it first 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. Thus the FS is always in a consistent state (the file got saved, the journal reports it as not completely saved, or the journal is inconsistent (but can be rebuilt from the filesystem)). Some journalling FSs can prevent corruption as well by writing data twice.

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||Yes||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||||
||<colspan="5">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. It is not recommended to install Linux on any type of FAT filesystem, because FAT does not have any of the permissions of a true Unix FS.

[http://en.wikipedia.org Wikipedia] has many excellent article about each of these filesystems and more.

Those used to a Windows FS know that it isn't normally possible to change files while they are open. This restriction does not exist in a Unix FS. The reason is in Unix filesystems, files are indexed by a number, called the inode, and each inode has several attributes associated with it, like permissions, name, etc. When you delete a file, what really happens is the inode is unlinked from the filename, but if some other program is using the file, it still has a link open to the OS, and will continue to be updated. A file is not really deleted until all links have been removed (even then, the data is still on the disk, but not indexed in anyway and thus very hard to recover). All of this means that you can delete executing programs while they're running without crashing and move files before they're finished downloading without corruption.

(more to come)

Links for more information:
 * [http://en.wikipedia.org/wiki/Comparison_of_file_systems Wikipedia: Comparison of File Systems]
 * [http://cbbrowne.com/info/fs.html Chris Browne's: File System's Explained]
 * [http://linux.org.mt/article/filesystems Filesystems for Linux]

CategoryDocumentation CategoryCleanup
#REFRESH 0 http://help.ubuntu.com/community/LinuxFilesystemsExplained

LinuxFilesystemsExplained (last edited 2008-08-06 16:22:11 by localhost)