由于 snap,/var/log 的大小非常大

由于 snap,/var/log 的大小非常大

最近我重启电脑后,电脑显示“磁盘空间不足警告”。我没有在意,结果磁盘空间/var/log不足,无法打开操作系统。所以我删除了 下的一些文件/var

现在是 %95,但开始时仍然会给出警告。在我单击该警告中的“检查”后,您可以在图片中看到:

点击警告上的检查按钮后

这是尺寸:

 canerveg@canerVegan  ~  df -h                              
Filesystem      Size  Used Avail Use% Mounted on
udev            7,7G     0  7,7G   0% /dev
tmpfs           1,6G   97M  1,5G   7% /run
/dev/nvme0n1p5   61G  6,9G   51G  12% /
tmpfs           7,7G  715M  7,0G  10% /dev/shm
tmpfs           5,0M  4,0K  5,0M   1% /run/lock
tmpfs           7,7G     0  7,7G   0% /sys/fs/cgroup
/dev/nvme0n1p2  946M  144M  737M  17% /boot
/dev/nvme0n1p1  975M   11M  964M   2% /boot/efi
/dev/nvme0n1p6  149G   34G  107G  25% /home
/dev/nvme0n1p4  5,6G  5,2G  143M  98% /var
/dev/loop1      9,2M  9,2M     0 100% /snap/canonical-livepatch/99
/dev/loop3      100M  100M     0 100% /snap/core/11316
/dev/loop4       56M   56M     0 100% /snap/core18/2066
/dev/loop7       65M   65M     0 100% /snap/gtk-common-themes/1514
/dev/loop5      163M  163M     0 100% /snap/gnome-3-28-1804/145
/dev/loop6      219M  219M     0 100% /snap/gnome-3-34-1804/66
/dev/loop8       66M   66M     0 100% /snap/gtk-common-themes/1515
/dev/loop10     323M  323M     0 100% /snap/wine-platform-6-stable/5
/dev/loop16      51M   51M     0 100% /snap/snap-store/542
/dev/loop17      33M   33M     0 100% /snap/snapd/12398
/dev/loop18      56M   56M     0 100% /snap/core18/2074
/dev/loop22      51M   51M     0 100% /snap/snap-store/547
/dev/loop19     323M  323M     0 100% /snap/wine-platform-6-stable/3
/dev/loop21     165M  165M     0 100% /snap/gnome-3-28-1804/161
/dev/loop23     5,5M  5,5M     0 100% /snap/notepad-plus-plus/285
/dev/loop24     304M  304M     0 100% /snap/wine-platform-5-stable/16
/dev/loop25     219M  219M     0 100% /snap/gnome-3-34-1804/72
tmpfs           1,6G   28K  1,6G   1% /run/user/125
tmpfs           1,6G   48K  1,6G   1% /run/user/1000
/dev/loop26     338M  338M     0 100% /snap/wine-platform-runtime/228
/dev/loop12     100M  100M     0 100% /snap/core/11420
/dev/loop2       33M   33M     0 100% /snap/snapd/12704
/dev/loop14     5,5M  5,5M     0 100% /snap/notepad-plus-plus/287
/dev/loop20      11M   11M     0 100% /snap/canonical-livepatch/104
/dev/loop27     338M  338M     0 100% /snap/wine-platform-runtime/231

我不知道/var会用得很多。这就是为什么我只给了 5.7 GB。

最大的文件/var

✘ canerveg@canerVegan  ~  sudo du -h --max-depth=6 /var | sort -h|tail -n25
6,1M    /var/cache/cracklib
6,4M    /var/lib/gdm3
6,6M    /var/cache/cups
8,1M    /var/cache/apparmor
8,9M    /var/lib/snapd/snapshots
12M /var/lib/app-info/icons/ubuntu-focal-universe/64x64
12M /var/log
17M /var/lib/app-info/icons/ubuntu-focal-universe
20M /var/lib/app-info
20M /var/lib/app-info/icons
28M /var/cache/app-info
28M /var/cache/app-info/cache
70M /var/lib/dpkg/info
75M /var/lib/dpkg
84M /var/cache/apt
148M    /var/cache
422M    /var/lib/snapd/seed
422M    /var/lib/snapd/seed/snaps
527M    /var/lib/apt
527M    /var/lib/apt/lists
1,8G    /var/lib/snapd/snaps
2,1G    /var/lib/snapd/cache
4,3G    /var/lib/snapd
4,9G    /var/lib
5,1G    /var

我想我可以安全地删除它:

2,1G    /var/lib/snapd/cache

但为什么我必须删除这些?如果我知道它会涨得这么高,我可以增加尺寸。我应该增加尺寸吗,因为我有

/dev/nvme0n1p6  149G   34G  107G  25% /home

但缩小/调整大小会有风险。

这些是快照:

 canerveg@canerVegan  ~  snap list --all    
Name                    Version                     Rev    Tracking         Publisher   Notes
canonical-livepatch     9.6.2                       99     latest/stable    canonical✓  disabled
canonical-livepatch     9.7.2                       104    latest/stable    canonical✓  -
core                    16-2.51.1                   11316  latest/stable    canonical✓  core,disabled
core                    16-2.51.3                   11420  latest/stable    canonical✓  core
core18                  20210507                    2066   latest/stable    canonical✓  base,disabled
core18                  20210611                    2074   latest/stable    canonical✓  base
gnome-3-28-1804         3.28.0-19-g98f9e67.98f9e67  145    latest/stable    canonical✓  disabled
gnome-3-28-1804         3.28.0-19-g98f9e67.98f9e67  161    latest/stable    canonical✓  -
gnome-3-34-1804         0+git.3556cb3               66     latest/stable/…  canonical✓  disabled
gnome-3-34-1804         0+git.3556cb3               72     latest/stable/…  canonical✓  -
gtk-common-themes       0.1-52-gb92ac40             1515   latest/stable/…  canonical✓  -
gtk-common-themes       0.1-50-gf7627e4             1514   latest/stable/…  canonical✓  disabled
notepad-plus-plus       8.1.2                       287    latest/stable    mmtrt       -
notepad-plus-plus       8.1.1                       285    latest/stable    mmtrt       disabled
snap-store              3.38.0-63-g766b86f          542    latest/stable/…  canonical✓  disabled
snap-store              3.38.0-64-g23c4c77          547    latest/stable/…  canonical✓  -
snapd                   2.51.3                      12704  latest/stable    canonical✓  snapd
snapd                   2.51.1                      12398  latest/stable    canonical✓  snapd,disabled
wine-platform-5-stable  5.0.3                       16     latest/stable    mmtrt       -
wine-platform-6-stable  6.0.1                       3      latest/stable    mmtrt       disabled
wine-platform-6-stable  6.0.1                       5      latest/stable    mmtrt       -
wine-platform-runtime   v1.0                        231    latest/stable    mmtrt       -
wine-platform-runtime   v1.0                        228    latest/stable    mmtrt       disabled

这里删除了旧版本: https://www.debugpoint.com/2021/03/clean-up-snap/

但我正在考虑彻底删除 snap。我可以随时从 snap 安装某些东西。你觉得怎么样?

软件更新程序正在下载一些更新,但它也会减少 /var 的大小。那么,我无法下载大于 5 gb 的任何 apt,因为我有 5 gb 的 /var?

软件更新程序

我去了软件中心。单击已安装选项卡并删除了所有 Wine。有 3 个 Wine。我不知道我为什么要安装它们,或者也许安装了某个应用程序才能运行。

现在看起来好多了:

 canerveg@canerVegan  ~  snap list --all
Name                 Version                     Rev    Tracking         Publisher   Notes
canonical-livepatch  9.7.2                       104    latest/stable    canonical✓  -
canonical-livepatch  9.6.2                       99     latest/stable    canonical✓  disabled
core                 16-2.51.3                   11420  latest/stable    canonical✓  core
core                 16-2.51.1                   11316  latest/stable    canonical✓  core,disabled
core18               20210507                    2066   latest/stable    canonical✓  base,disabled
core18               20210611                    2074   latest/stable    canonical✓  base
gnome-3-28-1804      3.28.0-19-g98f9e67.98f9e67  161    latest/stable    canonical✓  -
gnome-3-28-1804      3.28.0-19-g98f9e67.98f9e67  145    latest/stable    canonical✓  disabled
gnome-3-34-1804      0+git.3556cb3               66     latest/stable/…  canonical✓  disabled
gnome-3-34-1804      0+git.3556cb3               72     latest/stable/…  canonical✓  -
gtk-common-themes    0.1-50-gf7627e4             1514   latest/stable/…  canonical✓  disabled
gtk-common-themes    0.1-52-gb92ac40             1515   latest/stable/…  canonical✓  -
notepad-plus-plus    8.1.1                       285    latest/stable    mmtrt       disabled
notepad-plus-plus    8.1.2                       287    latest/stable    mmtrt       -
snap-store           3.38.0-63-g766b86f          542    latest/stable/…  canonical✓  disabled
snap-store           3.38.0-64-g23c4c77          547    latest/stable/…  canonical✓  -
snapd                2.51.1                      12398  latest/stable    canonical✓  snapd,disabled
snapd                2.51.3                      12704  latest/stable    canonical✓  snapd

 canerveg@canerVegan  ~  cd /var/lib/snapd/snaps
 canerveg@canerVegan  /var/lib/snapd/snaps  ls
canonical-livepatch_104.snap  core18_2066.snap          gnome-3-34-1804_66.snap      notepad-plus-plus_285.snap  snapd_12704.snap
canonical-livepatch_99.snap   core18_2074.snap          gnome-3-34-1804_72.snap      notepad-plus-plus_287.snap  snap-store_542.snap
core_11316.snap               gnome-3-28-1804_145.snap  gtk-common-themes_1514.snap  partial                     snap-store_547.snap
core_11420.snap               gnome-3-28-1804_161.snap  gtk-common-themes_1515.snap  snapd_12398.snap

 canerveg@canerVegan  /var/lib/snapd/snaps  df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            7,7G     0  7,7G   0% /dev
tmpfs           1,6G  2,5M  1,6G   1% /run
/dev/nvme0n1p5   61G  7,2G   51G  13% /
tmpfs           7,7G  733M  7,0G  10% /dev/shm
tmpfs           5,0M  4,0K  5,0M   1% /run/lock
tmpfs           7,7G     0  7,7G   0% /sys/fs/cgroup
/dev/nvme0n1p2  946M   93M  789M  11% /boot
/dev/nvme0n1p1  975M   11M  964M   2% /boot/efi
/dev/nvme0n1p6  149G   34G  107G  25% /home
/dev/nvme0n1p4  5,6G  3,8G  1,6G  71% /var
/dev/loop1      9,2M  9,2M     0 100% /snap/canonical-livepatch/99
/dev/loop3      100M  100M     0 100% /snap/core/11316
/dev/loop4       56M   56M     0 100% /snap/core18/2066
/dev/loop7       65M   65M     0 100% /snap/gtk-common-themes/1514
/dev/loop5      163M  163M     0 100% /snap/gnome-3-28-1804/145
/dev/loop6      219M  219M     0 100% /snap/gnome-3-34-1804/66
/dev/loop8       66M   66M     0 100% /snap/gtk-common-themes/1515
/dev/loop16      51M   51M     0 100% /snap/snap-store/542
/dev/loop17      33M   33M     0 100% /snap/snapd/12398
/dev/loop18      56M   56M     0 100% /snap/core18/2074
/dev/loop22      51M   51M     0 100% /snap/snap-store/547
/dev/loop21     165M  165M     0 100% /snap/gnome-3-28-1804/161
/dev/loop23     5,5M  5,5M     0 100% /snap/notepad-plus-plus/285
/dev/loop25     219M  219M     0 100% /snap/gnome-3-34-1804/72
tmpfs           1,6G   28K  1,6G   1% /run/user/125
tmpfs           1,6G   60K  1,6G   1% /run/user/1000
/dev/loop12     100M  100M     0 100% /snap/core/11420
/dev/loop2       33M   33M     0 100% /snap/snapd/12704
/dev/loop14     5,5M  5,5M     0 100% /snap/notepad-plus-plus/287
/dev/loop20      11M   11M     0 100% /snap/canonical-livepatch/104
 canerveg@canerVegan  /var/lib/snapd/snaps  

但我认为我需要删除其他快照或应用程序或甚至来源列表。

还:

 canerveg@canerVegan  ~  sudo apt-get autoclean
Reading package lists... Done
Building dependency tree       
Reading state information... Done
 canerveg@canerVegan  ~  sudo apt-get autoremove                          
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 40 not upgraded.

磁盘

答案1

您所犯的错误与安装或使用 Snaps 无关。

您犯了一个典型的高级新用户错误:您进行了过度分区。

让我们看一下输出的片段:

    /dev/nvme0n1p5   61G  6,9G   51G  12% /
    /dev/nvme0n1p6  149G   34G  107G  25% /home
    /dev/nvme0n1p4  5,6G  5,2G  143M  98% /var

Ubuntu 安装程序建议使用单个根分区(包括 /var 和 /home),结果将类似如下...

    /dev/nvme0n1p4  217G   46G  171G  21% /

...并且您不会遇到任何有关完整分区的问题。

备份您的数据。重新分区以符合您的实际用途。重新安装。

相关内容