首頁  >  問答  >  主體

Linux(Ubuntu)在阿里云上的磁盘空间异常

在linux下,使用df -h命令查看磁盘空间使用量,显示已使用了100%,而实际用到的远没有那么多。

root@iZ94yakhyenZ:/# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       20G   20G     0 100% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            990M  4.0K  990M   1% /dev
tmpfs           201M  384K  200M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none           1001M     0 1001M   0% /run/shm
none            100M     0  100M   0% /run/user

du -h查看,根目录下的用量为6.8G。

root@iZ94yakhyenZ:/# du --max-depth=1 -h
4.0K    ./opt
9.6M    ./bin
384K    ./run
4.0K    ./srv
4.0K    ./lib64
0    ./sys
8.5M    ./sbin
34M    ./boot
4.0K    ./home
4.0K    ./dev
du: cannot access './proc/12212/task/12212/fd/4': No such file or directory
du: cannot access './proc/12212/task/12212/fdinfo/4': No such file or directory
du: cannot access './proc/12212/fd/4': No such file or directory
du: cannot access './proc/12212/fdinfo/4': No such file or directory
0    ./proc
283M    ./lib
24K    ./tmp
28K    ./root
4.0K    ./media
2.1G    ./mnt
803M    ./usr
16K    ./lost+found
3.7G    ./var
4.7M    ./etc
6.8G    .

系统为ubuntu14.04,是运行在阿里云上的虚拟机。

是什么原因导致这种现象呢?

黄舟黄舟2743 天前891

全部回覆(2)我來回復

  • 阿神

    阿神2017-04-17 13:47:59

    linux的一個特性,如果把一個正在被運行中的程式打開的檔案刪除,雖然看起來檔案已經不在了,但仍然佔用磁碟空間。
    可以透過執行lsof|grep delete看到所有被開啟但有被刪除的檔案列表,找出哪個是日誌檔案。
    通常是apache或nginx的日誌,這個時候需要重啟下apache或是nginx就可以了。

    回覆
    0
  • 阿神

    阿神2017-04-17 13:47:59

    你刪掉了正在使用的日誌。 。 。

    所以,找到對應的進程然後重新啟動下。

    回覆
    0
  • 取消回覆