inode linux

Inodes in Linux is a data structure that stores metadata about files. The inode is short for index node.

Linux中的Inode是一种数据结构,用于存储有关文件的元数据。 索引节点是索引节点的缩写。

It contains the following information about a file :

它包含有关文件的以下信息:

  • User ID of the file文件的用户ID
  • Group ID of the file 文件的组ID
  • Device ID设备编号
  • File size文件大小
  • Date of creation创建日期
  • Permission允许
  • Owner of the file文件的所有者
  • File protection flag文件保护标志
  • Link counter to determine the number of hard links链接计数器,确定硬链接数

Linux stores data in the form of blocks in the memory. Inode of a file contains a list of all the blocks in which a file is stored. Whereas, the inode of a directory contains a mapping of files and directories it contains to their respective inodes.

Linux以块形式将数据存储在内存中。 文件的索引节点包含存储文件的所有块的列表。 而目录的inode包含文件和目录到其各自inode的映射。

Linux system internally identifies a file with its inode number and not its name. That is why the inode doesn’t contain the name of the file. This also helps in maintaining multiple hard links as files with different file names can point to the same inode. The symbolic name of a file is stored in the enclosing directory, not in the inode.

Linux系统在内部使用文件的索引节点号而不是名称来标识文件。 这就是为什么索引节点不包含文件名的原因。 这也有助于维护多个硬链接,因为具有不同文件名的文件可以指向同一inode。 文件的符号名称存储在封闭目录中,而不存储在inode中。

multiple files pointing to the same inode
多个文件指向同一个inode

查看索引节点状态 (Viewing inode stats)

The total number of inodes on a system are limited and can be accessed by using the following command:

系统上inode的总数是有限的,可以使用以下命令进行访问:


$ df -i

The table shows the inode usage for different filesystems. IFree is the number of inodes that are free to be used. IUsed is the number of inodes in use.

下表显示了不同文件系统的inode用法。 IFree是可以免费使用的索引节点数。 IUsed是使用中的索引节点数。

使用ls命令查找inode (Finding the inode with the ls command)

You can run ls with ‘-i’ flag to get the inode number along with ls command output.

您可以使用带有-i标志的ls来获取inode编号以及ls命令输出。


ls -i

The number before each file name indicates the inode number for that file. Inodes are stored together in a table and the inode number is the index where that particular inode is stored.

每个文件名之前的数字表示该文件的索引节点号。 索引节点一起存储在一个表中,索引节点号是存储该特定索引节点的索引。

An inode is allocated when the file is created. The first free inode from the table is overwritten to be assigned to the file being created.

创建文件时分配一个inode。 表中的第一个空闲索引节点将被覆盖,以分配给正在创建的文件。

查看文件统计 (Viewing file stats )

Stats for a file or a directory can be viewed using the command :

可以使用以下命令查看文件或目录的统计信息:


$ stat [file_name]

Here ‘example.txt’ is a text file while ‘test’ is a directory. The stat command shows the number of memory blocks allocated for the file, inode number, number of links, and access permissions.

这里的“ example.txt”是一个文本文件,而“ test”是一个目录。 stat命令显示为文件分配的内存块数,索引节点数,链接数和访问权限。

结论 (Conclusion )

Inodes in Linux are used to store metadata for files and directories. Users don’t interact with inodes directly. Inodes are used by the Linux file system to identify and perform operations on the file. We hope this guide helped you understand inodes better. If you have any more questions, drop them in the comments!

Linux中的Inode用于存储文件和目录的元数据。 用户不直接与inode交互。 Linux文件系统使用Inode来标识文件并对其执行操作。 我们希望本指南可以帮助您更好地了解inode。 如果您还有其他问题,请将其放在评论中!

翻译自: https://www.journaldev.com/41609/inodes-in-linux

inode linux

inode linux_Linux中的inode是什么?相关推荐

  1. linux 挂载分区inode,Linux中分区挂载和LABEL的指定

    让Linux开机就挂载分区,我知道有两种方法,一种是fstab,另一种是rc.local,我比较倾向前一种. 这两种方法各要注意: fstab是在开机时就挂载,所以你要注意是否你的分区位于某个需要特别 ...

  2. Linux中的 inode以及 软硬链接分析

    一. inode 是什么?(索引节点)理解inode 需要知道文件存储,文件是存储在硬盘上的,操作系统读取硬盘的时候会连续读取多个扇区(硬盘的最小存储单元),即一次性读取一个块(文件存取的最小单位). ...

  3. Linux文件系统中的inode节点详细介绍

    一.inode是什么? 理解inode,要从文件储存说起. 文件储存在硬盘上,硬盘的最小存储单位叫做"扇区"(Sector).每个扇区储存512字节(相当于0.5KB). 操作系统 ...

  4. 内核中根据inode得到文件名_聊聊DOS操作系统中的文件系统FAT12

    前面我们更多的集中在Linux系统下文件系统的介绍,是时候介绍一下其它文件系统了.今天我们介绍一下Windows操作系统下的文件系统,也就是FAT文件系统.严格的来说其实是DOS的文件系统.今天我们介 ...

  5. linux中的inode节点

    一.背景 传统的磁盘与文件系统的应用中,一个分区就只能够被格式化成一个文件系统,所以我们可以说一个文件系统就是一个分区.但是由于新技术的利用,例如我们常听到的LVM与软磁盘阵列(software ra ...

  6. Linux文件系统中的inode

    磁盘中最小的存储单位是"扇区",操作系统中文件最小的存储单位是"块",一个"块"由连续的8个"扇区"组成,一个文件可以由 ...

  7. linux中的 inode 详解

    转载于: https://blog.csdn.net/u012243115/article/details/45536985 一.inode是什么? 理解inode,要从文件储存说起.文件储存在硬盘上 ...

  8. linux中的inode文件编号和软硬链接

    目录 inode编码 磁盘 扇区 目录下的data block inode 和 文件名的关系 软硬链接 硬链接 软连接 inode编码 一个文件,对应一个inode属性节点,inode编号,linux ...

  9. linux内核中根据inode获取文件的完整路径

    1.概述 构成一个操作系统最重要的部分就是进程管理和文件系统了. Linux最初采用的是minix的文件系统,minix是由Andrew S. Tanenbaum开发的用于实验性的操作系统,比如有一些 ...

最新文章

  1. asp.net里导出excel表方法汇总
  2. 医保费用监控指标体系建立(四)医疗机构指标分析
  3. Python中的支持向量机SVM的使用(有实例有源码)
  4. go genetlink demo
  5. [蓝桥杯2016决赛]七星填数-next_permutation枚举
  6. Java中的Google ClientLogin实用程序
  7. ubuntu 16.04常用命令
  8. 转载:JAVA获取时间戳,哪个更快
  9. COPAN为政府机构提供低成本、高效节能的数字归档方案
  10. 医学专业考计算机三级,2020年9月中国医科大学计算机等级考试报名通知
  11. arm linux系统启动流程
  12. 苹果Mac白噪音软件:Noise Machine
  13. PPT计时软件(可手动、可自动,支持OFFICE、WPS)
  14. 自定义Unity调色板
  15. matlab随机函数
  16. Python爬取第一电影天堂最新电影(5000多部)代码实例(一)
  17. js获取元素相对于父级元素的高度
  18. Contour Integral
  19. 建筑企业应采用电子招投标的10个理由
  20. VMware卸载不干净导致无法重安

热门文章

  1. 《微服务设计》(一)---- 微服务
  2. NHibernate官方文档中文版——批量插入(Batch inserts)
  3. [BZOJ2733] [HNOI2012] 永无乡 (splay启发式合并)
  4. DirectUI的初步分析-转
  5. 从鞋子的磨损度看性格
  6. nginx做代理上网
  7. [转载] boost python numpy_boost.python 与 boost.numpy安装的一些注意事项
  8. 史上最细的FIFO最小深度计算,(大多数笔试题中都会涉及)
  9. 第十六篇 Python之迭代器与生成器
  10. jquery的img的动态title换行