我有一个 centos 5.5 VM (6GB) 仅用于 php 开发,最近我注意到空间丢失了:
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
5.7G 5.3G 187M 97% /
/dev/sda1 99M 18M 76M 20% /boot
tmpfs 252M 0 252M 0% /dev/shm
du -h / | grep ^[0-9.]*G
1.2G /www
1.6G /usr
3.5G /
我在 / 中没有任何文件,只有 .autofsck(0 字节),这些空间在哪里?
编辑:有什么新想法吗?
答案1
可能在 /tmp 中,但使用以下命令按大小查找目录,从 / 执行:
du -sk */ | sort -nr
答案2
如果文件已从文件系统中删除但未被所有应用程序关闭,则该文件将保留在文件系统上并占用空间,但无法被诸如 之类的工具检测到du
。终止相关应用程序(最简单的方法是重新启动)将释放空间。
答案3
您是否检查过隐藏文件/目录?最简单的命令是
du -h * | less
答案4
人tune2fs:
-m reserved-blocks-percentage
Set the percentage of the filesystem which may only be allocated
by privileged processes. Reserving some number of filesystem
blocks for use by privileged processes is done to avoid filesys-
tem fragmentation, and to allow system daemons, such as sys-
logd(8), to continue to function correctly after non-privileged
processes are prevented from writing to the filesystem. Nor-
mally, the default percentage of reserved blocks is 5%.
所以:
tune2fs -m0 /dev/mapper/VolGroup00-LogVol00