根目录 (/dev/vda1) 上的空间不足。不明白为什么

Son*_*oul 5 partitioning disk-usage 16.04

我有一个新的 Ubuntu Digital Ocean Droplet,它的根空间一直不足。

df

Filesystem     1K-blocks      Used Available Use% Mounted on
udev             2013876         0   2013876   0% /dev
tmpfs             404640     10740    393900   3% /run
/dev/vda1       81120924  81104144       396 100% /          <----------<<<<< 396k space left after running apt clean commands. it keeps going down to 0 
tmpfs            2023196         0   2023196   0% /dev/shm
tmpfs               5120         0      5120   0% /run/lock
tmpfs            2023196         0   2023196   0% /sys/fs/cgroup
/dev/sda       363979364 245756248  99856652  72% /mnt/volume-nyc1-04
/dev/vda15        106858      3437    103421   4% /boot/efi
tmpfs             404640         0    404640   0% /run/user/1000
tmpfs             404640         0    404640   0% /run/user/0
Run Code Online (Sandbox Code Playgroud)

80gig/分区处于 100%

但是当我切换到 / 并执行操作时

du -sk -x -h *

16M bin
65M boot
0   dev
du: cannot access 'etc/ssl/certs/Camerfirma_Global_Chambersign_Root.pem': Structure needs cleaning
du: cannot access 'etc/ssl/certs/Certigna.pem': Structure needs cleaning
5.6M    etc
40M home
0   initrd.img
0   initrd.img.old
159M    lib
4.0K    lib64
16K lost+found
4.0K    media
8.0K    mnt
4.0K    opt
du: cannot access 'proc/4713/task/4713/fd/4': No such file or directory
du: cannot access 'proc/4713/task/4713/fdinfo/4': No such file or directory
du: cannot access 'proc/4713/fd/4': No such file or directory
du: cannot access 'proc/4713/fdinfo/4': No such file or directory
0   proc
32K root
11M run
14M sbin
8.0K    snap
4.0K    srv
0   sys
36K tmp
1.1G    usr
254M    var
0   vmlinuz
0   vmlinuz.old
Run Code Online (Sandbox Code Playgroud)

我无法把它加起来超过几场演出。不知道 80 场演出都去哪儿了!

到目前为止,我尝试了一些 apt clean 命令,但几乎没有什么区别。

这是较大软件包的列表,但我不确定哪些可以安全清除

dpkg-query --show --showformat='${Package;-50}\t${Installed-Size}\n' | sort -k 2 -n | grep -v deinstall | awk '{printf "%.3f MB \t %s\n", $2/(1024), $1}'

3.883 MB     ncurses-term
3.890 MB     libmagic1
3.958 MB     libdns162
4.039 MB     command-not-found-data
4.351 MB     linux-libc-dev
4.409 MB     libpython3.5
5.310 MB     geoip-database
6.102 MB     coreutils
6.307 MB     bitcoind
6.499 MB     dpkg
6.572 MB     udev
6.922 MB     perl-base
7.180 MB     linux-headers-4.4.0-133-generic
7.188 MB     linux-headers-4.4.0-134-generic
8.069 MB     lxd-client
8.517 MB     libpython2.7-stdlib
8.644 MB     python3.5-minimal
9.623 MB     libpython3.5-stdlib
10.696 MB    libc6
11.355 MB    grub-common
11.907 MB    libgcc-5-dev
12.921 MB    libc6-dev
13.023 MB    binutils
13.363 MB    locales
14.912 MB    libstdc++-5-dev
15.659 MB    iso-codes
16.714 MB    lxd
16.858 MB    perl-modules-5.22
18.414 MB    systemd
19.877 MB    libperl5.22
20.911 MB    cpp-5
22.343 MB    g++-5
23.000 MB    git
23.121 MB    gcc-5
26.240 MB    vim-runtime
29.389 MB    libicu55
38.940 MB    libpython2.7-dev
51.022 MB    libpython3.5-dev
64.915 MB    linux-image-4.4.0-131-generic
64.935 MB    linux-image-4.4.0-133-generic
64.947 MB    linux-image-4.4.0-134-generic
67.640 MB    linux-headers-4.4.0-133
67.645 MB    linux-headers-4.4.0-134
77.453 MB    snapd
Run Code Online (Sandbox Code Playgroud)

当我这样做时.. ./mnt 显示的比它的大小大,这很奇怪(驱动器只有 350 gigs)。还有所有这些访问错误是怎么回事

sudo du -hd 1 | sort -h

du: cannot access './proc/5000/task/5000/fd/4': No such file or directory
du: cannot access './proc/5000/task/5000/fdinfo/4': No such file or directory
du: cannot access './proc/5000/fd/3': No such file or directory
du: cannot access './proc/5000/fdinfo/3': No such file or directory
du: cannot access './etc/ssl/certs/Camerfirma_Global_Chambersign_Root.pem': Structure needs cleaning
du: cannot access './etc/ssl/certs/Certigna.pem': Structure needs cleaning
0   ./dev
0   ./proc
0   ./sys
4.0K    ./lib64
4.0K    ./media
4.0K    ./opt
4.0K    ./srv
8.0K    ./snap
16K ./lost+found
32K ./root
36K ./tmp
5.6M    ./etc
11M ./run
14M ./sbin
16M ./bin
40M ./home
68M ./boot
159M    ./lib
254M    ./var
1.1G    ./usr
469G    ./mnt
471G    .
Run Code Online (Sandbox Code Playgroud)

这是/mnt的内容。其中一些可能是本地文件吗?

:/mnt# ls -al
total 20
drwxr-xr-x  5 root root 4096 Aug 27 18:04 .
drwxr-xr-x 23 root root 4096 Aug 27 16:33 ..
drwxr-xr-x  2 root root 4096 Aug 18 14:36 volume-nyc1-03
drwxr-xr-x  4 root root 4096 Aug 27 16:42 volume_nyc1_04
drwxr-xr-x  4 root root 4096 Aug 27 16:42 volume-nyc1-04


:/mnt# du -sk -x -h *
4.0K    volume-nyc1-03
235G    volume_nyc1_04
Run Code Online (Sandbox Code Playgroud)

检查磁盘是否有一些东西。

$:/# sudo fsck -nf /dev/vda1

fsck from util-linux 2.27.1
e2fsck 1.42.13 (17-May-2015)
Warning!  /dev/vda1 is mounted.
Warning: skipping journal recovery because doing a read-only filesystem check.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Entry 'Camerfirma_Global_Chambersign_Root.pem' in /etc/ssl/certs (1490) has deleted/unused inode 1521.  Clear? no

Entry 'Camerfirma_Global_Chambersign_Root.pem' in /etc/ssl/certs (1490) has an incorrect filetype (was 7, should be 0).
Fix? no

Entry 'Certigna.pem' in /etc/ssl/certs (1490) has deleted/unused inode 1522.  Clear? no

Entry 'Certigna.pem' in /etc/ssl/certs (1490) has an incorrect filetype (was 7, should be 0).
Fix? no

Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences:  -16499
Fix? no

Inode bitmap differences:  -(1521--1522)
Fix? no


cloudimg-rootfs: ********** WARNING: Filesystem still has errors **********

cloudimg-rootfs: 109495/10321920 files (0.6% non-contiguous), 20938940/20943099 blocks
Run Code Online (Sandbox Code Playgroud)

blu*_*112 2

首先,您可以添加-x选项以防止du遍历文件系统。

然后添加sort -h按文件大小排序

最后,以 root 身份运行此命令。

du -shx /* | sort -rh
Run Code Online (Sandbox Code Playgroud)

这可以帮助您通过查看第一行来了解发生了什么,而无需花费太多时间探索您的/mnt.


您的文件似乎也有文件系统损坏/etc//etc/文件不太可能很大,但您仍然可以在文件系统变得更糟之前检查文件系统是否有错误。

如果您无法计算出空间消耗量,请在 /etc/ 中运行相同的命令,这样您就可以知道在没有损坏的目录的情况下所需的大小。