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:

  1. log files
    1. project log files residing in your deployment folder.
    2. system logs, residing in /var/log directory.
  2. unused docker containers and images.
    1. Look up by docker images for images. Remove unused ones with docker rmi $image id
    2. Loop up by docker ps -a for containers, and remove unused by docker rm $container_id
  3. Update the system, and remove unwanted packages.
    `sudo apt update && sudo apt upgrade -y && sudo apt autoremove`
  4. 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`
  5. 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.