-1

I don't have much experience in system administration. I have installed a Mastodon instance on a VPS running Ubuntu 20.04. After ten days the server has been completely filled, which seems very rare to me. How can 38Gb be filled?

If I do a df -h, I get this:

Filesystem      Size  Used Avail Use% Mounted on
udev            949M     0  949M   0% /dev
tmpfs           194M  860K  193M   1% /run
/dev/sda1        38G   36G     0 100% /
tmpfs           968M   28K  968M   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           968M     0  968M   0% /sys/fs/cgroup
/dev/sda15      253M  138K  252M   1% /boot/efi
tmpfs           194M     0  194M   0% /run/user/0

As can be seen, the file system mounted on /dev/sda1 is completely full.

There must be something that takes up a lot of space, how can I find it? How can I find a directory that takes up a lot of space?

du -h doesn't work for me because it starts printing thousands of lines and doesn't stop.

I would appreciate any hint or help.

[EDIT] I don't want to delete the question even though it's been tagged as a duplicate because the linked question doesn't have the du -h --max-depth=1 command among its answers, which for me has been crucial.

aitor
  • 271
  • 2
  • 8
  • 2
    try `du -h --max-depth=1` and proceed with the investigation based on the results. Perhaps some log files are becoming large in `/var/log`. – Doug Smythies Jan 02 '23 at 18:56
  • 1
    Yes! it works! With this command I have been delimiting the large directory and I now know where the problem is. Thanks a lot. – aitor Jan 02 '23 at 19:12
  • Duplicate questions are not deleted. And the command you mentioned are not among the answers here too. – Pilot6 Jan 03 '23 at 15:37
  • My fault. Fixed. – aitor Jan 03 '23 at 15:39

2 Answers2

1

As Doug said in the comments, with du -h --max-depth=1 I can delimiting the large directory.

aitor
  • 271
  • 2
  • 8
  • 1
    You could do `sudo apt autoremove && sudo apt autoclean` – Rishon_JR Jan 03 '23 at 05:35
  • 1
    There is also a program called [BleachBit](https://www.bleachbit.org/download/linux). This is a system cleaner used to cleanup nd optimise your system. – Rishon_JR Jan 03 '23 at 05:40
1

For a better and interactive overview you can use ncdu.

Start count from current dir: ncdu -x

Start count from custom dir: ncdu -x /some/dir

(-x parameter is for "Do not cross filesystem boundaries")

NotTheDr01ds
  • 15,380
  • 6
  • 51
  • 79
k3dAR
  • 46
  • 3