Linux--常见问题:修改磁盘 inode 数量

Linux--常见问题:修改磁盘 inode 数量,第1张

node这个词大多资料都是译为索引节点,在ext3文件系统,调整磁盘的inode number。这里只是调整inode number这个参数,如果想调整inode size或是blocksize等可以具体查看mkfs.ext3命令。

磁盘 inode 一般用于大量小文件的存储中消耗较快

#>umount /data0

#>mkfs.ext3 /dev/sda6 -N ”inode节点数“

#>vi /etc/fstab

/dev/sda6               /data0                  ext3    defaults        1 2

#>mount -a

#>dumpe2fs -h /dev/sda6 | grep node

[注意]调整inode数会格式化磁盘,执行前应确定磁盘上没有重要数据或是先备份数据

mkfs.ext3的与inode相关的参数介绍

       -i bytes-per-inode

              Specify the bytes/inode ratio.   mke2fs  creates  an  inode  for

              every  bytes-per-inode  bytes  of space on the disk.  The larger

              the bytes-per-inode ratio, the fewer  inodes  will  be  created.

              This  value generally shouldn?? be smaller than the blocksize of

              the filesystem, since then too many inodes  will  be  made.   Be

              warned  that is not possible to expand the number of inodes on a

              filesystem after it is created, so be careful deciding the  cor-

              rect value for this parameter.

       -N number-of-inodes

              overrides the default calculation of the number of  inodes  that

              should  be  reserved  for  the filesystem (which is based on the

              number of blocks and the bytes-per-inode  ratio).   This  allows

              the user to specify the number of desired inodes directly.

在 Linux 系统中,VFS(Virtual File System)是一个抽象层,它使得 Linux 内核能够与多种文件系统进行交互。VFS 使用 inode(Index Node)来管理文件系统中的文件和目录

inode 是一个数据结构,它存储着文件或目录的元数据信息,如文件大小、创建时间、权限等。每个文件或目录在文件系统中都对应一个 inode,而 inode 又与一个编号相关联,这个编号就是 inode 的编号。

当文件或目录被创建时,VFS 会为它分配一个 inode 编号,并且创建一个 inode 数据结构来存储元数据信息。当文件或目录被访问时,VFS 会根据 inode 编号来查找对应的 inode 数据结构,从而获取文件或目录的信息。

因此,inode 是 VFS 在 Linux 系统中管理文件和目录的一种重要方式。它能够帮助 VFS 快速查找文件或目录的信息,从而提高文件系统的性能。

1、首先登陆到Linux主机。

2、使用命令CD切换工作目录,示例:cdwwwdoc。

3、按下回车键,即可成功执行命令,切换工作目录。

4、使用命令ll可以列出当前目录下的所有文件。

5、查看其中某个文件的详细信息(包括inode),可以使用stat命令,示例:statfolder1即可。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/7374339.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-04
下一篇 2023-04-04

发表评论

登录后才能评论

评论列表(0条)

保存