无法动态增加 UFS 文件系统上的 inode 数量。
如果需要增加 inode 的数量,则需要使用 newfs 重新构建文件系统。
on It Road.com
使用 newfs 增加 inode
我们可以让文件系统报告它已满,但是当我们查看 df -k 输出时,文件系统上似乎仍有剩余空间。
此问题的原因是由于文件系统上存在大量小文件。
这可能会用完为该文件系统分配的所有 inode,但仍有足够的磁盘空间。
要检查 inode,请运行以下命令 df -o i filesystem:
# df -o i /data Filesystem iused ifree %iused Mounted on /dev/dsk/c0t0d0s7 13 1241587 0% /data
如我们所见,我对 inode 没有问题,如果确实有问题,则输出将指示 %iused 100% 。
有一种方法可以解决此问题,首先我们需要对受影响的文件系统进行良好的备份。
然后我们可以运行 mkfs -m 命令来查看文件系统是如何创建的,如下所示。
# mkfs -m /dev/rdsk/c0t0d0s7 mkfs -F ufs -o nsect=255,ntrack=16,bsize=8192,fragsize=1024,cgsize=26,free=1,rps=90,nbpi=8235,opt=t,apc=0,gap=0,nrpos=8,maxcontig=16 /dev/rdsk/c0t0d0s7 20481600
about 输出的关键字段是 nbpi=8235 (number bytes per inode) 。
在运行 newfs 命令以创建新文件系统时,可以更改 nbpi。
以下内容来自 newfs 手册页。
-i nbpi The number of bytes per inode. This specifies the density of inodes in the file system. The number is divided into the total size of the file system to determine the fixed number of inodes to create. It should reflect the expected average size of files in the file system. If fewer inodes are desired, a larger number should be used; to create more inodes a smaller number should be given. The default for nbpi is as fol lows:. Disk size Density Less than 1GB 2048 Less than 2GB 4096 Less than 3GB 6144 3GB to 1 Tbyte 8192 Greater than 1 Tbyte 1048576 or created with -T
备份要增加 inode 的文件系统后,我们可以使用 -i nbpi 选项指定较小的数字来新建文件系统。
由于 mkfs -m /dev/rdsk/c0t0d0s7 的输出显示 nbpi=8235,如果在运行带有 nbpi 选项 (-i 4117) 的 newfs 命令时将该数字减半,它将使该文件系统上的 inode 增加一倍。
然后在执行 newfs 并增加它们的 inode 之后,我们可以从开始此过程之前创建的备份中恢复文件系统。
日期:2020-09-17 00:15:22 来源:oir作者:oir