Nytro Posted December 11, 2010 Report Posted December 11, 2010 Linux File Systems 101Something every body should know about Linux file systems---- INTRODUCTION ----I'll talk today about the different and "commonly" used Linux file systems, as I see not so much people that really know the difference between them. And in fact there is a whole lot to it more than just generalizing the usage of each file system, they have different usage purposes and different futures that you might or might not want.Also I'd like to inform you that this article is NOT based on my personal experience of using the different file systems and I'd rather go with facts instead of following personal favorites as every case is different from the other.The information I gathered are freely available on the world wide web, and they are not special information whatsoever, meaning that anyone could find such information, but I thought a good short article about the subject will do no harm.This article will cover EXT2, EXT3, XFS and ReiserFS so no talking about any other "different" OS specific file system, so please don't bring other OS's file systems discussions over here.There will be no historical information here whatsoever, this article main purpose is to provide technical yet simple information about these various file systems to help you in the decision making process of choosing one over the other or better is mixing between them to maximize efficiency.---- STRUCTURES ----EXT2:File allocation: bitmap (free space), table (meta data)Bad blocks: tableEXT3:Directory contents: table, H tree with dir_index* enabledFile allocation: bitmap (free space), table (meta data)Bad block: tableReiserFS:Directory contents: B treeFile allocation: bitmapXFS:Directory contents: B treeFile allocation: B treeAs we see here there are different structures, and they differ between the B trees and H trees, the B tree data structure keeps data sorted and allows searches, insertions, and deletions in logarithmic amortized time, it is commonly used in databases and file systems. In the other hand we have the H trees structure which is commonly used in VLSI as a clock distribution network (Basically it's a revised version of a B tree data structure for larger directories).* dir_index is an option that allows indexing which is turned on by typing the command tune2fs -O dir_index /dev/hdXXX.---- LIMITS ----EXT2:Max file size: 2-64 TiBMax number of files: 10^8Max filename length: 255 bytesMax volume size: 16-32 TiBAllowed characters in filenames: Any byte except 'NUL' and 0x2FEXT3:Max file size: 16 GiB - 2 TiBMax number of files: Variable*Max filename length: 255 bytesMax volume size: 2-32 TiBAllowed characters in filenames: Any byte except 'NUL' and 0x2FReiserFS:Max file size: 8 TiBMax number of files: 2^32Max filename length: 4032 bytes, limited to 255 by Linux VFS (Virtual File System)Max volume size: 16 TiBAllowed characters in filenames: Any byte except 'NUL' and 0x2FXFS:Max file size: 8 EiB minus one byte (on x64 bit system) 16 TiB (on x32 bit system)Max filename length: 255 bytesMax volume size: 16 EiBAllowed characters in filenames: Any byte except 'NULL'* If V is the volume size in bytes, then the default number of inodes is given by V/(2^13) or the number of blocks, whichever is less. And the minimum is V/(2^23). The max number of subdirectories in one directory is fixed to 32000.I think the information above are self explanatory, so I don't have comments on this part of information except to get your attention on the difference between 'NUL' and 'NULL', they are in fact different and mean totally different things, the 'NUL' is a string termination character while 'NULL' means NO thing.---- FEATURES ----EXT2:Dates recorded: modification (mtime), attribute modification (ctime), access (atime)Date range: December 14, 1901 - January 18, 2038Date resolution: 1sFile system permission: POSIXTransparent compression: NO (available through patches)Transparent encryption: NOSupported OS's: Linux, BSD, Windows (through an IFS), Mac OS XEXT3:Dates recorded: modification (mtime), attribute modification (ctime), access (atime)Date range: December 14, 1901 - January 18, 2038Date resolution: 1s, Nanosecond (using undocumented big i-node)Attributes: No-atime, append-only, synchronous-write, no-dump, h-tree (directory), immutable, journal, secure-delete, top (directory), allow-undeleteFile system permission: Unix permissions, ACLs and arbitrary security attributes (Linux 2.6 and later)Transparent compression: NOTransparent encryption: NO (provided at the block device level)Supported OS's: Linux, BSD, Windows (through an IFS)ReiserFS:Dates recorded: modification (mtime), attribute modification (ctime), access (atime)Date range: December 14, 1901 - January 18, 2038Date resolution: 1sForks: Extended attributesFile system permission: Unix permissions, ACLs and arbitrary security attributesTransparent compression: NOTransparent encryption: NOSupported OS's: LinuxXFS:Dates recorded: modification (mtime), attribute modification (ctime), access (atime)Date resolution: 1nsAttributes: YESFile system permission: YESTransparent compression: NOTransparent encryption: NO (provided at the block device level)Supported OS's: IRIX, Linux, FreeBSD (experimental)---- LINKS ----http://www.virtualblueness.net/Ext2fs-overview/Ext2fs-overview-0.1-8.htmlhttp://www.google.com/search?hl=en&q=H+treehttp://www.google.com/search?hl=en&q=B+treehttp://www.google.com/search?hl=en&q=amortized+timehttp://www.google.com/search?hl=en&q=very+large+scale+integrationhttp://www.google.com/search?hl=en&q=POSIXhttp://www.google.com/search?hl=en&q=Installable+File+System---- FINAL WORD ----As I said, these are the facts, however they might not reflect fixed performance, so everyone might encounter different results and different issues that is not the case with everybody else. Basically based on this information you will be able to decide which file system you going to need for your special usage, but I also advice you to seek opinions from experts that had past experiences with specific file systems and knows the tricks and tweaks to improve it or to how to keep disasters from happening. Sursa: Linux File Systems 101 - r00tsecurity Quote