找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 130|回复: 12

一个比较奇怪的linux问题,我的硬盘空间跑哪里去了?

[复制链接]

71

主题

578

回帖

1379

积分

金牌会员

积分
1379
发表于 2018-4-7 12:19:05 | 显示全部楼层 |阅读模式
本帖最后由 biubiu 于 2018-4-7 12:59 编辑



这个占用好奇怪啊,为什么丢了那么多空间

莫名不见几十G

从df命令里面看,一共是738G,但是用了4.7G,可用只有696G


[ol]
  • root@server1:~# df -h
  • Filesystem      Size  Used Avail Use% Mounted on
  • /dev/vda1       738G  4.7G  696G   1% /
  • udev             10M     0   10M   0% /dev
  • tmpfs           201M  4.5M  196M   3% /run
  • tmpfs           501M     0  501M   0% /dev/shm
  • tmpfs           5.0M     0  5.0M   0% /run/lock
  • tmpfs           501M     0  501M   0% /sys/fs/cgroup
  • [/ol]复制代码[ol]
  • root@server1:~# du -sh /*
  • 16K        /appex
  • 11M        /bin
  • 30M        /boot
  • 0        /dev
  • 4.1M        /etc
  • 297M        /home
  • 0        /initrd.img
  • 205M        /lib
  • 4.0K        /lib64
  • 16K        /lost+found
  • 8.0K        /media
  • 4.0K        /mnt
  • 1.5M        /opt
  • du: cannot access ‘/proc/2371/task/2371/fd/4’: No such file or directory
  • du: cannot access ‘/proc/2371/task/2371/fdinfo/4’: No such file or directory
  • du: cannot access ‘/proc/2371/fd/4’: No such file or directory
  • du: cannot access ‘/proc/2371/fdinfo/4’: No such file or directory
  • 0        /proc
  • 539M        /root
  • 4.5M        /run
  • 5.1M        /sbin
  • 1.5M        /serverspeeder
  • 4.0K        /srv
  • 0        /sys
  • 32K        /tmp
  • 3.2G        /usr
  • 453M        /var
  • 0        /vmlinuz
  • [/ol]复制代码
  • 回复

    使用道具 举报

    8

    主题

    106

    回帖

    246

    积分

    中级会员

    积分
    246
    发表于 2018-4-7 12:42:00 | 显示全部楼层
    不懂 你说哪少了几十g
    回复

    使用道具 举报

    8

    主题

    106

    回帖

    246

    积分

    中级会员

    积分
    246
    发表于 2018-4-7 12:36:41 | 显示全部楼层
    哪有问题?好像对的上啊
    回复

    使用道具 举报

    71

    主题

    578

    回帖

    1379

    积分

    金牌会员

    积分
    1379
     楼主| 发表于 2018-4-7 12:38:56 | 显示全部楼层


    搜刀一大堆du和dh不一致的解决办法

    可是我的df和du大小好像没什么区别
    回复

    使用道具 举报

    71

    主题

    578

    回帖

    1379

    积分

    金牌会员

    积分
    1379
     楼主| 发表于 2018-4-7 12:41:52 | 显示全部楼层

    kumotobi 发表于 2018-4-7 12:36

    哪有问题?好像对的上啊

    738 4.7 696

    可用加已用一共700G好像
    回复

    使用道具 举报

    8

    主题

    106

    回帖

    246

    积分

    中级会员

    积分
    246
    发表于 2018-4-7 12:36:00 | 显示全部楼层
    Deleting the filename doesn't actually delete the file. Some other process is holding the file open, causing it to not be deleted; restart or kill that process to release the file.

    Use

    lsof +L1
    to find out which process is using a deleted (unlinked) file.

    转自stackoverflow 供参考
    回复

    使用道具 举报

    71

    主题

    578

    回帖

    1379

    积分

    金牌会员

    积分
    1379
     楼主| 发表于 2018-4-7 12:46:03 | 显示全部楼层

    kumotobi 发表于 2018-4-7 12:46

    Deleting the filename doesn't actually delete the file. Some other process is holding the file open, ...

    dalao我试了找到对应服务,然后重启服务,但是好像不行
    [ol]
  • root@server1:~# lsof | grep delete
  • httpd      957             root   10u      REG              254,1        0        825 /tmp/ZCUDSeCFKw (deleted)
  • httpd     1202              www   10u      REG              254,1        0        825 /tmp/ZCUDSeCFKw (deleted)
  • httpd     1203              www   10u      REG              254,1        0        825 /tmp/ZCUDSeCFKw (deleted)
  • httpd     1204              www   10u      REG              254,1        0        825 /tmp/ZCUDSeCFKw (deleted)
  • httpd     1205              www   10u      REG              254,1        0        825 /tmp/ZCUDSeCFKw (deleted)
  • httpd     1206              www   10u      REG              254,1        0        825 /tmp/ZCUDSeCFKw (deleted)
  • httpd     2340              www   10u      REG              254,1        0        825 /tmp/ZCUDSeCFKw (deleted)
  • root@server1:~# service httpd restart
  • root@server1:~# df -h
  • Filesystem      Size  Used Avail Use% Mounted on
  • /dev/vda1       738G  3.1G  697G   1% /
  • udev             10M     0   10M   0% /dev
  • tmpfs           201M  4.5M  196M   3% /run
  • tmpfs           501M     0  501M   0% /dev/shm
  • tmpfs           5.0M     0  5.0M   0% /run/lock
  • tmpfs           501M     0  501M   0% /sys/fs/cgroup
  • root@server1:~# lnmp restart
  • +-------------------------------------------+
  • |    Manager for LNMP, Written by Licess    |
  • +-------------------------------------------+
  • |              https://lnmp.org             |
  • +-------------------------------------------+
  • Stoping LAMP...
  • stop apache... httpd (no pid file) not running
  • done
  • [ ok ] Stopping mysql (via systemctl): mysql.service.
  • Starting LAMP...
  • start apache...  done
  • [ ok ] Starting mysql (via systemctl): mysql.service.
  • root@server1:~# df -h
  • Filesystem      Size  Used Avail Use% Mounted on
  • /dev/vda1       738G  3.1G  697G   1% /
  • udev             10M     0   10M   0% /dev
  • tmpfs           201M  4.5M  196M   3% /run
  • tmpfs           501M     0  501M   0% /dev/shm
  • tmpfs           5.0M     0  5.0M   0% /run/lock
  • tmpfs           501M     0  501M   0% /sys/fs/cgroup
  • [/ol]复制代码
  • 回复

    使用道具 举报

    8

    主题

    106

    回帖

    246

    积分

    中级会员

    积分
    246
    发表于 2018-4-7 12:52:15 | 显示全部楼层

    biubiu 发表于 2018-4-7 12:52

    dalao我试了找到对应服务,然后重启服务,但是好像不行

    reboot
    回复

    使用道具 举报

    71

    主题

    578

    回帖

    1379

    积分

    金牌会员

    积分
    1379
     楼主| 发表于 2018-4-7 12:46:00 | 显示全部楼层

    kumotobi 发表于 2018-4-7 12:54

    reboot

    这个试过好几次了,好像也是不行
    [ol]
  • root@server1:~# reboot
  • Connection closing...Socket close.
  • Connection closed by foreign host.
  • Disconnected from remote host(hatch-los) at 12:50:15.
  • Type `help' to learn how to use Xshell prompt.
  • [c:\~]$
  • Looking up proxy server 'localhost'...
  • Host 'localhost' resolved to ::1.
  • Connecting to ::1:1090...
  • Connection established.
  • To escape to local shell, press 'Ctrl+Alt+]'.
  • The programs included with the Debian GNU/Linux system are free software;
  • the exact distribution terms for each program are described in the
  • individual files in /usr/share/doc/*/copyright.
  • Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
  • permitted by applicable law.
  • root@server1:~# df -h
  • Filesystem      Size  Used Avail Use% Mounted on
  • /dev/vda1       738G  3.1G  697G   1% /
  • udev             10M     0   10M   0% /dev
  • tmpfs           201M  4.5M  196M   3% /run
  • tmpfs           501M     0  501M   0% /dev/shm
  • tmpfs           5.0M     0  5.0M   0% /run/lock
  • tmpfs           501M     0  501M   0% /sys/fs/cgroup
  • root@server1:~#
  • [/ol]复制代码
    binghe 发表于 2018-4-7 14:28

    我记得以前有人跟我说过,ext文件系统有5%左右的保留空间,如果需要释放的话可以用 tune2fs -m 1 /dev/vd ...



    原来是这样啊
    738*0.05,大概也就是37g左右,那就没问题了
  • 回复

    使用道具 举报

    0

    主题

    1

    回帖

    4

    积分

    新手上路

    积分
    4
    发表于 2018-4-7 12:54:05 | 显示全部楼层
    有5%的预留备份空间
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    Archiver|手机版|小黑屋|Discuz! X

    GMT+8, 2025-2-23 07:23 , Processed in 0.022944 second(s), 7 queries , Gzip On, Redis On.

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

    快速回复 返回顶部 返回列表