Flatpak 佔用過多系統空間處理小記
OS: openSUSE Leap 15
Flatpak : 0.10.4
家中工作的桌機是使用準系統 with SSD
今天早上收到 / 目錄已經 100 % 使用無可用空間嚇了一跳
使用 df -h 觀察
> df -h
檔案系統 容量 已用 可用 已用% 掛載點
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 97M 7.7G 2% /dev/shm
tmpfs 7.8G 400M 7.4G 6% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/sda2 40G 33G 0 100% /
/dev/sda2 40G 33G 0 100% /opt
/dev/sda2 40G 33G 0 100% /boot/grub2/i386-pc
/dev/sda1 500M 5.0M 495M 1% /boot/efi
/dev/sda2 40G 33G 0 100% /var
/dev/sda2 40G 33G 0 100% /tmp
/dev/sda2 40G 33G 0 100% /usr/local
/dev/sda3 185G 46G 140G 25% /home
/dev/sda2 40G 33G 0 100% /.snapshots
/dev/sda2 40G 33G 0 100% /boot/grub2/x86_64-efi
一開始是以為 /.snapshots 佔用太多空間
所以參考自己之前的筆記
使用 snapper list 指令列出 snapshot
# snapper list
Type | # | Pre # | Date | User | Cleanup | Description | Userdata
-------+-----+-------+--------------------------+------+---------+-------------------+--------------
single | 0 | | | root | | current |
single | 1 | | Sat Jun 9 11:15:49 2018 | root | | 首個根文件系統 |
pre | 341 | | Thu Feb 14 18:40:24 2019 | root | number | zypp(zypper) | important=yes
post | 342 | 341 | Thu Feb 14 18:46:53 2019 | root | number | | important=yes
pre | 351 | | Thu Feb 21 16:08:45 2019 | root | number | zypp(packagekitd) | important=yes
post | 352 | 351 | Thu Feb 21 16:10:24 2019 | root | number | | important=yes
pre | 355 | | Wed Feb 27 23:12:58 2019 | root | number | zypp(packagekitd) | important=yes
post | 356 | 355 | Wed Feb 27 23:18:24 2019 | root | number | | important=yes
pre | 387 | | Sun Mar 10 12:44:15 2019 | root | number | zypp(packagekitd) | important=yes
post | 388 | 387 | Sun Mar 10 12:45:46 2019 | root | number | | important=yes
pre | 391 | | Tue Mar 19 00:05:35 2019 | root | number | zypp(packagekitd) | important=yes
post | 392 | 391 | Tue Mar 19 00:06:26 2019 | root | number | | important=yes
pre | 393 | | Tue Mar 19 22:29:24 2019 | root | number | zypp(packagekitd) | important=no
post | 394 | 393 | Tue Mar 19 22:29:27 2019 | root | number | | important=no
pre | 395 | | Tue Mar 19 23:26:49 2019 | root | number | zypp(zypper) | important=no
post | 396 | 395 | Tue Mar 19 23:27:11 2019 | root | number | | important=no
pre | 397 | | Tue Mar 19 23:28:46 2019 | root | number | zypp(zypper) | important=no
post | 398 | 397 | Tue Mar 19 23:29:18 2019 | root | number | | important=no
pre | 399 | | Tue Mar 19 23:35:50 2019 | root | number | zypp(zypper) | important=no
post | 400 | 399 | Tue Mar 19 23:35:55 2019 | root | number | | important=no
pre | 401 | | Sat Mar 23 07:34:21 2019 | root | number | zypp(packagekitd) | important=no
post | 402 | 401 | Sat Mar 23 07:34:41 2019 | root | number | | important=no
pre | 403 | | Sun Mar 31 07:49:14 2019 | root | number | zypp(packagekitd) | important=yes
將上面不重要的 snapshot 刪除
# snapper delete 392-401
再次觀察系統空間
# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 105M 7.7G 2% /dev/shm
tmpfs 7.8G 408M 7.4G 6% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/sda2 40G 33G 7.7G 81% /
/dev/sda2 40G 33G 7.7G 81% /opt
/dev/sda2 40G 33G 7.7G 81% /boot/grub2/i386-pc
/dev/sda1 500M 5.0M 495M 1% /boot/efi
/dev/sda2 40G 33G 7.7G 81% /var
剛剛看到的 7.7G 可用空間出現, 但是馬上就被使用掉, 一樣變成 / 目錄 100% 使用
接下來針對 / 目錄統計各個子目錄的使用量
使用 du -h --max-depth=1 的方式來統計
# du -h --max-depth=1 /
41M /etc
107G /.snapshots
89M /boot
45G /home
569M /opt
79M /root
0 /srv
351M /tmp
8.8G /usr
20G /var
0 /dev
du: cannot access '/proc/20112/task/20112/fd/4': No such file or directory
du: cannot access '/proc/20112/task/20112/fdinfo/4': No such file or directory
du: cannot access '/proc/20112/fd/3': No such file or directory
du: cannot access '/proc/20112/fdinfo/3': No such file or directory
0 /proc
0 /sys
956M /lib
2.1M /bin
11M /lib64
0 /mnt
du: cannot access '/run/user/1000/gvfs': Permission denied
416M /run
11M /sbin
0 /selinux
6.3G /Dropbox
189G /
突然發現 /var 佔用 20G 的空間
繼續往下調查
# du -h --max-depth=1 /var/
1.2G /var/log
8.3G /var/lib
783M /var/cache
9.2G /var/tmp
317M /var/adm
0 /var/crash
0 /var/opt
8.0K /var/spool
4.0K /var/yp
20G /var/
# du -h --max-depth=1 /var/tmp
7.8M /var/tmp/flatpak-cache-2B2MKZ
36K /var/tmp/zypp.atCqun
48K /var/tmp/zypp.vyW6nm
36K /var/tmp/zypp.R9eXSe
36K /var/tmp/zypp.hZV8jz
48K /var/tmp/zypp.dtsdx0
7.9M /var/tmp/flatpak-cache-QXUVKZ
36K /var/tmp/zypp.68tiq1
56K /var/tmp/zypp.zOwY3U
7.3M /var/tmp/flatpak-cache-IKF1KZ
36K /var/tmp/zypp.gcPRR6
48K /var/tmp/zypp.hoHw65
0 /var/tmp/flatpak-cache-VEPLKZ
36K /var/tmp/zypp.qIRQwP
48K /var/tmp/zypp.2VqXSy
0 /var/tmp/flatpak-cache-9LJALZ
36K /var/tmp/zypp.beK6KH
56K /var/tmp/zypp.evFJPt
64M /var/tmp/flatpak-cache-MON9KZ
36K /var/tmp/zypp.5wzRTC
36K /var/tmp/zypp.22hmgH
48K /var/tmp/zypp.9c6xPl
9.0M /var/tmp/flatpak-cache-KKY9KZ
36K /var/tmp/zypp.ey32Sy
56K /var/tmp/zypp.yoeVvl
52K /var/tmp/zypp.WvOT0f
9.2M /var/tmp/flatpak-cache-U9U6LZ
發現在 /var/tmp/ 目錄下有很多 flatpak-cache-* 檔案
暫時性的解法
手動刪除 /var/tmp/ 底下的 flatpak-cache-*
#rm -rf /var/tmp/flatpak-cache-*
快樂的空間回來了
# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 77M 7.7G 1% /dev/shm
tmpfs 7.8G 424M 7.4G 6% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/sda2 40G 25G 16G 61% /
/dev/sda2 40G 25G 16G 61% /opt
/dev/sda2 40G 25G 16G 61% /boot/grub2/i386-pc
/dev/sda1 500M 5.0M 495M 1% /boot/efi
/dev/sda2 40G 25G 16G 61% /var
另外一個讓我注意到的是 flatpak 在 /var/lib/flatpak 也會佔用相當多的空間
# du -h --max-depth=1 /var/lib/flatpak/
2.3G /var/lib/flatpak/repo
16M /var/lib/flatpak/runtime
4.0K /var/lib/flatpak/appstream
418M /var/lib/flatpak/app
168K /var/lib/flatpak/exports
0 /var/lib/flatpak/.removed
2.7G /var/lib/flatpak/
先把相對應的方式記錄下來
也注意 flatpak 有這樣的狀況產生
~ enjoy it
Reference
沒有留言:
張貼留言