[+] 增加清理磁盘脚本
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 52s

This commit is contained in:
Martin 2025-02-06 09:37:50 +08:00
parent f7edc9d09e
commit c862c17133
2 changed files with 22 additions and 0 deletions

View File

@ -64,3 +64,8 @@ docker compose run ubuntu ./init-all.sh
```bash
docker compose run ubuntu-2204 ./init-all.sh
```
### 清理磁盘
```bash
curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/clean.sh | bash
```

17
clean.sh Normal file
View File

@ -0,0 +1,17 @@
# 清理 apt
sudo apt-get autoremove -y
sudo apt-get autoclean -y
sudo apt-get clean -y
# 清理 docker
docker system prune -a -f --volumes
# 清理日志
sudo journalctl --vacuum-size=10M
# 列出清理后容器大小
docker ps -a --format "{{.ID}}\t{{.Image}}\t{{.Size}}"
docker images --format "{{.Repository}}:{{.Tag}}\t{{.Size}}"
# 列出磁盘空间
df -h
# 查看占用磁盘
# sudo du -ah / | sort -rh | head -20