Tuesday, April 10, 2012

What is EXT2 ?

Ext2 is the standard file system of GNU/Linux. The feature of it is the excellent performance of accessing files. It shows its superiority for the small and medium size files. This is mostly because of the fine design of its cluster cache layer. 

The size of single file and the upper limit of file system capacity are related with the size of cluster. The biggest cluster is 4KB in the common X86 computer system. So the upper limit of single file is 2048GB, and upper limit of file system is 16384GB. But as the core 2.4 can only use the largest single partition 2048GB, so in fact the file system can be used is only 2048GB.

The Second Extended File System (ext2) is the standard file system of Linux system. It is attained by expanding the Minix file system. It has a excellent feature of accessing files. In the ext2 file system, files are uniquely identified by inode (includes all the informations about files). One file may correspond to a few file names. Unless all the file names are deleted, the related file can be deleted. Besides, one same file has different inode when being saved or being opened. The kernel is responsible for synchronization.
Ext2 file system uses level-three indirect block to save data block poiter. And the space is allocated in block (default 1 KB). The strategy of partition is to allocate logically contiguous files to physically contiguous blocks and try the best to allocate fragment to the least files, so that to promote the performance on the whole. Ext2 file system trys the best to put the files (includes directories) under one directory to one block, but directories to various blocks to realize load balance. When expanding files, it will expand 8 continuous block files in one time (realized with reservation space).

2. Directory Structure
In ext2 file system, directories are saved as files. The root directory is always in the second position of inode list. And the subdirectory is defined in the content of root directory files. the directory entry is defined in include/linux/ext2_fs.h file.

3. File extended attributesThe attribute of one file is mostly the standard attribute of its inode structure, which also includes other extended atributes (related to all the inode of the system, often used to add extra functions), and it is defined in fs/ext2/xattr.h file. The i_file_acl filed of inode saves the extended attributes' number of block. The head of attributes is at the initial position of attributes block, thereafter attribute entry. Attributes value find the position according to the attributes entry.

No comments:

Post a Comment