![Centos 服务器没有磁盘空间但 df 说有足够的空间](https://linux22.com/image/713154/Centos%20%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%B2%A1%E6%9C%89%E7%A3%81%E7%9B%98%E7%A9%BA%E9%97%B4%E4%BD%86%20df%20%E8%AF%B4%E6%9C%89%E8%B6%B3%E5%A4%9F%E7%9A%84%E7%A9%BA%E9%97%B4%20.png)
我的 Centos 告诉我没有剩余磁盘空间:
[root@zff isos]# touch test
touch: cannot touch ‘test’: No space left on device
但自由度告诉我还有足够的空间:
[root@zff isos]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 3.6T 1.4T 2.2T 39% /
devtmpfs 32G 0 32G 0% /dev
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 32G 67M 32G 1% /run
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/sda4 497M 165M 333M 34% /boot
/dev/sda1 496M 9.8M 487M 2% /boot/efi
/dev/mapper/centos-home 75G 33M 75G 1% /home
tmpfs 6.3G 4.0K 6.3G 1% /run/user/0
我也没有用完 inode:
[root@zff isos]# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/centos-root 3791101952 82816 3791019136 1% /
devtmpfs 8209805 563 8209242 1% /dev
tmpfs 8211404 1 8211403 1% /dev/shm
tmpfs 8211404 1246 8210158 1% /run
tmpfs 8211404 13 8211391 1% /sys/fs/cgroup
/dev/sda4 512000 30 511970 1% /boot
/dev/sda1 0 0 0 - /boot/efi
/dev/mapper/centos-home 39321600 11 39321589 1% /home
tmpfs 8211404 3 8211401 1% /run/user/0
我不知道问题出在哪里。任何帮助都非常感谢!
以下是一些附加信息:
[root@zff isos]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda5 centos lvm2 a-- 3.63t 0
[root@zff isos]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 3 0 wz--n- 3.63t 0
[root@zff isos]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home centos -wi-ao---- 75.00g
root centos -wi-ao---- 3.53t
swap centos -wi-ao---- <31.45g
[root@zff isos]# sudo find /proc/*/fd -ls 2>/dev/null | grep '(deleted)'
121429799 0 lrwx------ 1 root root 64 Nov 7 15:34 /proc/8762/fd/7 -> /tmp/ffi2lKXH0\ (deleted)
121429814 0 lrwx------ 1 root root 64 Nov 7 15:34 /proc/8939/fd/8 -> /tmp/ffimBw8GN\ (deleted)
[root@zff isos]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sda: 3999.7 GB, 3999688294400 bytes, 7811891200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
# Start End Size Type Name
1 2048 1026047 500M EFI System EFI System Partition
2 1026048 1230847 100M unknown Basic data partition
3 1230848 5425151 2G Microsoft basic Basic data partition
4 5425152 6449151 500M Microsoft basic
5 6449152 7811889151 3.6T Linux LVM
Disk /dev/mapper/centos-swap: 33.8 GB, 33764147200 bytes, 65945600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-root: 3882.1 GB, 3882088398848 bytes, 7582203904 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-home: 80.5 GB, 80530636800 bytes, 157286400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
[root@zff /]# du -sh
du: cannot access ‘./proc/45722/task/45722/fd/4’: No such file or directory
du: cannot access ‘./proc/45722/task/45722/fdinfo/4’: No such file or directory
du: cannot access ‘./proc/45722/fd/4’: No such file or directory
du: cannot access ‘./proc/45722/fdinfo/4’: No such file or directory
1.4T .
编辑
[root@zff /]# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/mapper/centos-root xfs 3791076352 1440862400 2350213952 39% /
devtmpfs devtmpfs 32839220 0 32839220 0% /dev
tmpfs tmpfs 32845616 0 32845616 0% /dev/shm
tmpfs tmpfs 32845616 68484 32777132 1% /run
tmpfs tmpfs 32845616 0 32845616 0% /sys/fs/cgroup
/dev/sda4 xfs 508588 168456 340132 34% /boot
/dev/sda1 vfat 507904 9980 497924 2% /boot/efi
/dev/mapper/centos-home xfs 78604800 33000 78571800 1% /home
tmpfs tmpfs 6569124 4 6569120 1% /run/user/0
编辑2
[root@zff /]# xfs_ncheck /dev/mapper/centos-root
ERROR: The filesystem has valuable metadata changes in a log which needs to
be replayed. Mount the filesystem to replay the log, and unmount it before
re-running xfs_ncheck. If you are unable to mount the filesystem, then use
the xfs_repair -L option to destroy the log and attempt a repair.
Note that destroying the log may cause corruption -- please attempt a mount
of the filesystem before doing this.
must run blockget -n first
答案1
df
仅知道内核中已提交的文件系统更改。例如,如果您删除了大量正在使用的数据,则df
在保持这些文件打开的进程停止并释放资源之前不会反映这一点。这不是导致这种情况的唯一情况,但这种情况很常见。
df
通常会在重启后反映现实情况,但这是一个“大锤”解决方案。您可以通过搜索程序打开但也被删除的文件来查看问题所在。lsof
以下形式适用于这种情况:
lsof -nP +L1
您可能还需要考虑相反的情况,即您可能分配了df
尚未获取的数据。这种情况的解决方案主要取决于您使用的文件系统和内核。如果您让我知道您正在运行什么,这将为我提供一些关于这部分答案的指导。
答案2
重新启动服务器(init 6
)解决了我的问题。谢谢你的帮助。