My site is back, but i can’t make any editions. As soon as I try to save anything, i get a 502 Bad Gateway. Looking here and there i am finding out that i am running out of disk space. How to clean it and how to avoid it being full again… something is wrong… Someone gives a hand?

sudo df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            487M     0  487M   0% /dev
tmpfs           100M   11M   89M  11% /run
/dev/vda1        30G   30G     0 100% /
tmpfs           497M     0  497M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           497M     0  497M   0% /sys/fs/cgroup
tmpfs           100M     0  100M   0% /run/user/1000

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

You could use a command like this to help figure out where the disk usage is coming from:

du -a / | sort -nr | head -n 10

It lists the size of all files in the / directory, sorts them by size descending, and then prints only the ten largest files (useful if a directory has a lot of files).

Based on the output, you’ll need to revise the du -a / part to check different directories - it can depend on what applications you’re using but web server, database, or log file directories are probably good places to check.

Also, if you free up enough space (or you already have it installed), ncdu is also really helpful for viewing disk usage. With a command like ncdu -x /, you can use arrow keys to move around the filesystem and view disk usage.

I had this issue for several days, here is how i fixed it:

  1. Login to “Terminal” in digitalocean
  2. Write command to see which directorh is eating disk space du -a / | sort -nr | head -n 10
  3. In my case it was MySQL log files:
24252620        /var
22664740        /var/log
22032628        /var/log/mysqld.log
  1. Write command to empty log files
cat /dev/null > mysqld.log