模拟Linux磁盘分区有可用空间无可用Inodes时报错:No space left on device

WBOY
풀어 주다: 2016-06-07 16:48:29
원래의
1285명이 탐색했습니다.

模拟Linux磁盘分区有可用空间无可用Inodes时报错:No space left on device

参考:磁盘文件系统  1.创建测试脚本:

[Oracle@ocm1 ~]$ vi touchfile.sh

#!/bin/bash
for abc in {1..9}
do
touch /boot/test/$abc
done
"touchfile.sh" 5L, 66C written

2.创建测试目录、测试脚本

[root@ocm1 oracle]# cd /boot
[root@ocm1 boot]# mkdir test
[root@ocm1 boot]# ls
config-2.6.18-308.el5 symvers-2.6.32-300.10.1.el5uek.gz
config-2.6.32-300.10.1.el5uek System.map-2.6.18-308.el5
grub System.map-2.6.32-300.10.1.el5uek
initrd-2.6.18-308.el5.img test
initrd-2.6.32-300.10.1.el5uek.img vmlinuz-2.6.18-308.el5
lost+found vmlinuz-2.6.32-300.10.1.el5uek
symvers-2.6.18-308.el5.gz
[root@ocm1 boot]# cd -
/home/oracle
[root@ocm1 oracle]# sh touchfile.sh
[root@ocm1 oracle]# cd -
/boot
[root@ocm1 boot]# cd test
[root@ocm1 test]# ls
1 2 3 4 5 6 7 8 9

3.查看当前/boot目录可用Inodes数量

[root@ocm1 test]# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda3 7318528 185460 7133068 3% /
/dev/sda1 26104 50 26054 1% /boot
tmpfs 128334 1 128333 1% /dev/shm

4.修改脚本,直接将可用Inodes用光

[root@ocm1 boot]# cd /home/oracle/
[root@ocm1 oracle]# vi touchfile.sh
#!/bin/bash
for abc in {10..26110}
do
touch /boot/test/$abc
done
~
"touchfile.sh" 5L, 71C written

5.执行脚本,脚本未执行完,即报错:No space left on device,

事实上此时用df -h可以看到目录下有可用空间,,可是因为没有Inodes,已经无法新建文件了,报错为:No space left on device

[root@ocm1 oracle]# sh touchfile.sh
[root@ocm1 oracle]# sh touchfile.sh
touch: cannot touch `/boot/test/26064': No space left on device
touch: cannot touch `/boot/test/26065': No space left on device
………………………………………………
touch: cannot touch `/boot/test/26109': No space left on device
touch: cannot touch `/boot/test/26110': No space left on device
[root@ocm1 oracle]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 28G 11G 15G 43% /
/dev/sda1 99M 21M 73M 23% /boot
tmpfs 502M 0 502M 0% /dev/shm
[root@ocm1 oracle]# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda3 7318528 185460 7133068 3% /
/dev/sda1 26104 26104 0 100% /boot
tmpfs 128334 1 128333 1% /dev/shm
手动执行创建目录和文件命令报同样错误:
[root@ocm1 oracle]# cd /boot/
[root@ocm1 boot]# mkdir a
mkdir: cannot create directory `a': No space left on device
[root@ocm1 boot]# touch abc
touch: cannot touch `abc': No space left on device

本文永久更新链接地址:

linux

원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!