2014年(2)
分类: 系统运维
2014-01-02 17:48:01
The inode (index node) is a fundamental concept in the Linux and UNIX filesystem. Each object in the filesystem is represented by an inode.
Inodes store information about files and directories (folders), such as file ownership, access mode (read, write, execute permissions), and file type. On many types of file system implementations, the maximum number of inodes is fixed at file system creation, limiting the maximum number of files the file system can hold. A typical allocation heuristic for inodes in a file system is one percent of total size.
inode译成中文就是索引节点,每个存储设备(例如硬盘)或存储设备的分区被格式化为文件系统后,应该有两部份,一部份是inode,另一部份是
Block,Block是用来存储数据用的。而inode呢,就是用来存储这些数据的信息,这些信息包括文件大小、属主、归属的用户组、读写权限等。
inode为每个文件进行信息索引,所以就有了inode的数值。操作系统根据指令,能通过inode值最快的找到相对应的文件。
The inode number indexes a table of inodes in a known location on the
device; from the inode number, the file system driver portion of the
kernel can access the contents of the inode, including the location of
the file allowing access to the file.
A file's inode number can be found using the ls -i command. The ls -i command prints the i-node number in the first column of the report.
(可以通过ls -i 查看一个文件或目录的具体inode)。
5. 什么环境下需要调整inode大小。
大多数情况下,我们在格式化文件系统时候,可以采用默认的方法不对inode进行设置(the default inode size is based on the number of blocks and the bytes-per-inode ratio),但你的系统如果存放的基本全是小碎文件的话,就要进行调整了,因为默认的Inode空间可能已经无法存储索引节点。