Many a times our servers go out of disk space and we start scratching our heads which files are the culprits.
From my experience, I have encountered these to be the issue most of the times:
- log files
1. project log files residing in your deployment folder.
2. system logs, residing in/var/log
directory. - unused docker containers and images.
1. Look up bydocker images
for images. Remove unused ones withdocker rmi $image id
2. Loop up bydocker ps -a
for containers, and remove unused bydocker rm $container_id
- Update the system, and remove unwanted packages.
`sudo apt update && sudo apt upgrade -y && sudo apt autoremove` - To delete downloaded packages (.deb) already installed (and no longer needed)
`sudo apt-get clean`
To remove all stored archives in your cache for packages that can not be downloaded anymore (thus packages that are no longer in the repository or that have a newer version in the repository).
`sudo apt-get autoclean`
To remove unnecessary packages (After uninstalling an app there could be packages you don't need anymore)
`sudo apt-get autoremove`
To delete old kernel versions
`sudo apt remove --purge linux-image-X.X.XX-XX-generic` - Run
cd / && sudo du -h --max-depth=1
This will show the directories using max space in the system.
`cd` into the directories using unwanted space and clean the files there.
These steps should clean up your system most of the times.