如何诊断和修复丢失的驱动器空间?

Den*_*son 5 partition disk-usage fsck

/在 2T 驱动器上有一个小的 ext3分区,它的可用空间似乎存在差异。我如何确定导致它的原因以及如何修复它。

在尝试了我能想到的一切之后,我在启动时强制执行了 fsck,但没有任何影响。

我有其他配置相同的系统,但没有出现这种情况。

# df -h /
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             9.7G  8.9G  318M  97% /

# du -shx --max-depth 1 /
5.2G    /

# lsof | awk 'BEGIN {t=0} /(deleted)/ {t+=$7} END {print t}'
0

# tune4fs -l /dev/sda1 | grep -E 'state|Free|Reserve|size|Inode'
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super large_file
Filesystem state:         clean
Inode count:              2621440
Reserved block count:     131029
Free blocks:              212317
Free inodes:              2487281
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      639
Inodes per group:         32768
Inode blocks per group:   1024
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
Inode size:               128
Run Code Online (Sandbox Code Playgroud)

编辑:

fsck 说分区是 2% 不连续的。

为了与du上面的比较(稀疏性):

# du -hxs --apparent-size /
4.9G    /
Run Code Online (Sandbox Code Playgroud)

Gil*_*il' 6

我想到的一种解释是,您将一些东西隐藏在安装点后面,超出了du.

在 Linux 上,您可以对根文件系统进行绑定挂载,以便能够在不同的挂载点上查看所有内容。然后仔细查看原始视图中挂载点隐藏的内容。

mkdir /root/root-rebound
mount -o bind / /root/root-rebound
du -sc $(df -P | awk 'NR>2 {print "/root/root-rebound" $6}')
Run Code Online (Sandbox Code Playgroud)