learning ext2 steps notes(1)

reference:  http://e2fsprogs.sourceforge.net/ext2intro.html

This table contains a summary of the features provided by the different filesystems:

  Minix FS Ext FS Ext2 FS Xia FS
Max FS size 64 MB 2 GB 4 TB 2 GB
Max file size 64 MB 2 GB 2 GB 64 MB
Max file name 16/30 c 255 c 255 c 248 c
3 times support No No Yes Yes
Extensible No No Yes No
Var. block size No No Yes No
Maintained Yes No Yes ?

inode:

Each file is represented by a structure, called an inode. Each inode contains the description of the file: file type, access rights, owners, timestamps, size, pointers to data blocks. The addresses of data blocks allocated to a file are stored in its inode. When a user requests an I/O operation on the file, the kernel code converts the current offset to a block number, uses this number as an index in the block addresses table and reads or writes the physical block. 

Directories:

Directories are implemented as a special type of files. Actually, a directory is a file containing a list of entries. Each entry contains an inode number and a file name. When a process uses a pathname, the kernel code searchs in the directories to find the corresponding inode number. After the name has been converted to an inode number, the inode is loaded into memory and is used by subsequent requests.

what happend when a extern stroage was mounted:

When a filesystem is to be mounted, the appropriate mount function is called. This function is responsible for reading the superblock from the disk, initializing its internal variables, and returning a mounted filesystem descriptor to the VFS. After the filesystem is mounted, the VFS functions can use this descriptor to access the physical filesystem routines.

A mounted filesystem descriptor contains several kinds of data: informations that are common to every filesystem types, pointers to functions provided by the physical filesystem kernel code, and private data maintained by the physical filesystem code. The function pointers contained in the filesystem descriptors allow the VFS to access the filesystem internal routines.

Two other types of descriptors are used by the VFS: an inode descriptor and an open file descriptor. Each descriptor contains informations related to files in use and a set of operations provided by the physical filesystem code. While the inode descriptor contains pointers to functions that can be used to act on any file (e.g. createunlink), the file descriptors contains pointer to functions which can only act on open files (e.g. readwrite).

Note:  When such a file is deleted, random data is written in the disk blocks previously allocated to the file. This prevents malicious people from gaining access to the previous content of the file by using a disk editor.

   

猜你喜欢

转载自www.cnblogs.com/lianghong881018/p/10277543.html