当我运行时df -h
,我得到了这个:
该/dev/vda1
目录已使用 24G。我想找出哪些文件占用了空间。我试了一下du -shx /* | sort -rh
,得到了以下结果:
上面列出的/usr
最大容量是 2.8G。但是实际使用的却是 24G,而不是 2.8G。
ncdu
从内部使用/dev
也无济于事:
我该怎么做才能确定什么占用了 24G?
编辑:
/# sudo ls -l /
total 108
drwxr-xr-x 2 root root 4096 Nov 7 06:24 bin
drwxr-xr-x 4 root root 4096 Nov 14 06:43 boot
drwxr-xr-x 10 root root 4096 Nov 14 01:23 Bots
drwxr-xr-x 16 root root 3580 Nov 15 00:10 dev
drwxr-xr-x 125 root root 4096 Dec 6 22:15 etc
drwxr-xr-x 3 root root 4096 Jun 28 16:30 home
lrwxrwxrwx 1 root root 33 Nov 14 06:43 initrd.img -> boot/initrd.img-4.4.0-169-generic
lrwxrwxrwx 1 root root 33 Nov 14 06:43 initrd.img.old -> boot/initrd.img-4.4.0-168-generic
drwxr-xr-x 21 root root 4096 Jun 28 15:09 lib
drwxr-xr-x 2 root root 4096 Nov 14 18:31 lib64
drwx------ 2 root root 16384 Oct 4 2018 lost+found
drwxr-xr-x 2 root root 4096 Oct 4 2018 media
drwxr-xr-x 2 root root 4096 Oct 4 2018 mnt
drwxr-xr-x 4 root root 4096 Sep 24 18:55 opt
dr-xr-xr-x 126 root root 0 Nov 15 00:10 proc
drwx------ 25 root root 4096 Dec 6 20:39 root
drwxr-xr-x 26 root root 940 Dec 6 22:25 run
drwxr-xr-x 2 root root 12288 Oct 1 06:34 sbin
drwxr-xr-x 2 root root 4096 Oct 20 2018 snap
drwxrwxrwx 2 root root 4096 Nov 14 18:28 sources
drwxr-xr-x 2 root root 4096 Oct 4 2018 srv
drwxr-xr-x 3 root root 4096 Nov 14 17:45 stuff
dr-xr-xr-x 13 root root 0 Dec 6 22:30 sys
drwxrwxrwt 10 root root 12288 Dec 6 22:35 tmp
drwxr-xr-x 10 root root 4096 Oct 4 2018 usr
drwxr-xr-x 13 root root 4096 Oct 4 2018 var
lrwxrwxrwx 1 root root 30 Nov 14 06:43 vmlinuz -> boot/vmlinuz-4.4.0-169-generic
lrwxrwxrwx 1 root root 30 Nov 14 06:43 vmlinuz.old -> boot/vmlinuz-4.4.0-168-generic
编辑:
ncdu /
给出以下输出:
--- / ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2.4 GiB [##########] /usr
888.3 MiB [### ] /var
847.5 MiB [### ] /stuff
823.6 MiB [### ] /root
548.1 MiB [## ] /lib
293.5 MiB [# ] /Bots
267.4 MiB [# ] /opt
246.4 MiB [# ] /boot
15.6 MiB [ ] /bin
13.3 MiB [ ] /sbin
10.6 MiB [ ] /run
8.0 MiB [ ] /etc
180.0 KiB [ ] /tmp
20.0 KiB [ ] /home
e 16.0 KiB [ ] /lost+found
8.0 KiB [ ] /snap
4.0 KiB [ ] /dev
4.0 KiB [ ] /lib64
e 4.0 KiB [ ] /srv
e 4.0 KiB [ ] /sources
e 4.0 KiB [ ] /mnt
e 4.0 KiB [ ] /media
. 0.0 B [ ] /proc
0.0 B [ ] /sys
@ 0.0 B [ ] initrd.img.old
@ 0.0 B [ ] initrd.img
@ 0.0 B [ ] vmlinuz.old
@ 0.0 B [ ] vmlinuz
Total disk usage: 6.2 GiB Apparent size: 6.2 GiB Items: 404555
编辑:
# du -hsc .[!.]* *
du: cannot access '.[!.]*': No such file or directory
16M bin
247M boot
294M Bots
4.0K dev
8.1M etc
20K home
0 initrd.img
0 initrd.img.old
549M lib
4.0K lib64
16K lost+found
4.0K media
4.0K mnt
268M opt
du: cannot access 'proc/25571/task/25571/fd/4': No such file or directory
du: cannot access 'proc/25571/task/25571/fdinfo/4': No such file or directory
du: cannot access 'proc/25571/fd/4': No such file or directory
du: cannot access 'proc/25571/fdinfo/4': No such file or directory
0 proc
824M root
11M run
14M sbin
8.0K snap
4.0K sources
4.0K srv
848M stuff
0 sys
180K tmp
2.4G usr
889M var
0 vmlinuz
0 vmlinuz.old
6.3G total
编辑:
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 253:0 0 25G 0 disk
├─vda1 253:1 0 24.9G 0 part /
├─vda14 253:14 0 4M 0 part
└─vda15 253:15 0 106M 0 part /boot/efi