我的磁盘空间不足(10GB,使用了 71%)
df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 9.8G 6.5G 2.8G 71% /
udev 10M 0 10M 0% /dev
tmpfs 3.0G 128K 3.0G 1% /run
/dev/disk/by-uuid/af9b99b8-9f61-4eee-aa51-d5113368814d 9.8G 6.5G 2.8G 71% /
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 6.0G 0 6.0G 0% /run/shm
tmpfs 1.0G 6.1M 1018M 1% /mnt/tmp
但是当我运行这个命令来检查时,我只使用了 1.5G
sudo du --all --one-file-system / | awk '{if($1 > 102400) print int($1/1024) "MB" " " $2 }'
117MB /var/cache/apt/archives
164MB /var/cache/apt
168MB /var/cache
132MB /var/lib/apt/lists
132MB /var/lib/apt
148MB /var/lib
416MB /var
115MB /lib/modules/3.16.0-0.bpo.4-amd64/kernel/drivers
159MB /lib/modules/3.16.0-0.bpo.4-amd64/kernel
163MB /lib/modules/3.16.0-0.bpo.4-amd64
163MB /lib/modules
175MB /lib
223MB /usr/lib
146MB /usr/local/lib
106MB /usr/local/share
267MB /usr/local
199MB /usr/share
754MB /usr
1541MB /
有任何想法吗?
答案1
如果某个进程拥有一个指向已被删除的大文件的打开文件句柄,那么它仍会出现在磁盘使用情况中,但是该文件将无法访问,并且不会出现在 下du
。
# Create large file
$ df .
Filesystem 512-blocks Used Available Capacity iused ifree %iused Mounted on
/dev/disk0s2 1951845952 284650968 1666682984 15% 35645369 208335373 15% /
$ du -s
2604488 .
# Remove the file -note how the du result decreases
$ rm junk
$ df .
Filesystem 512-blocks Used Available Capacity iused ifree %iused Mounted on
/dev/disk0s2 1951845952 285526568 1665807384 15% 35754819 208225923 15% /
$ du -s
61728 .
# Kill the process holding the file - now the df usage decreases
Filesystem 512-blocks Used Available Capacity iused ifree %iused Mounted on
/dev/disk0s2 1951845952 282561000 1668772952 15% 35384123 208596619 15% /
$ du -s
61736 .