5

I just set up my site through AWS EC2 not that long ago from following YouTube tutorial. Now I have issue with no space left on the disk space and I tried to remove some of the old backup files I have. However, when I ran df -h it was showing /dev/nvme0n1p1 7.7G 7.5G 232M 98% /. I never ran into this kind of problem before and my site is still down. Is there a way to clean anything in nvme0n1p1? Thank you. (My site is very simple it just show some contents only nothing fancy)

➜  ~ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            470M     0  470M   0% /dev
tmpfs            97M  740K   96M   1% /run
/dev/nvme0n1p1  7.7G  7.5G  232M  98% /
tmpfs           481M     0  481M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           481M     0  481M   0% /sys/fs/cgroup
/dev/loop0       29M   29M     0 100% /snap/amazon-ssm-agent/2012
tmpfs            97M     0   97M   0% /run/user/1000
/dev/loop1       98M   98M     0 100% /snap/core/10126
/dev/loop2       98M   98M     0 100% /snap/core/10185
/dev/loop3       56M   56M     0 100% /snap/core18/1932
/dev/loop5       33M   33M     0 100% /snap/amazon-ssm-agent/2996

➜ ~ df -h /dev/nvme0n1p1 Filesystem Size Used Avail Use% Mounted on /dev/nvme0n1p1 7.7G 7.5G 232M 98% /

➜ ~ sudo du -m / | sort -nr | head -10 du: cannot access '/proc/1583/task/1583/fd/4': No such file or directory du: cannot access '/proc/1583/task/1583/fdinfo/4': No such file or directory du: cannot access '/proc/1583/fd/3': No such file or directory du: cannot access '/proc/1583/fdinfo/3': No such file or directory 8636 / 4818 /usr 3779 /usr/src 2188 /var 1052 /snap 1010 /var/lib 791 /var/log 785 /var/log/journal/3aa92fc7b26a4f78b870ea2dd0a76525 785 /var/log/journal 582 /snap/core

14079_Z
  • 161

3 Answers3

2

If the system is consistently running out of space, check that it’s not your log files in /var/log that are causing the shortage. If you’re using Apache or nginx, check that those logs are also being properly cleaned up.

  • Hi, I'm not sure if I'm doing it correctly, I ran df -h /var/log and got Filesystem Size Used Avail Use% Mounted on /dev/nvme0n1p1 7.7G 7.5G 232M 98% /. So is that mean it was from the log that causing the shortage? and if so, how do I clean it? Thank you. – 14079_Z Nov 23 '20 at 05:40
  • To check the size of a directory, you'll want to use dusudo du -hs /var/log –  Nov 23 '20 at 05:42
  • Hi, just did it and got 791M /var/log return. – 14079_Z Nov 23 '20 at 06:35
  • Well, the next thing to do would be to du every directory and find out where all of your storage is being used. You can query the whole system like this: sudo du -m / | sort -nr | head -10Note: this query will take a long time to run, depending on how many files and directories you have on your system. Do not be surprised if it takes 5 minutes. –  Nov 23 '20 at 07:03
  • Thanks. I just did and update the post with the result. So it looks like the path / and /usr is taking the most of the space? It is not an actual file so I don't know how to remove it or if it is safe to remove anything. I did sudo find / -type f -size +100M -exec ls -lh {} \; but got -r-------- 1 root root 128T Nov 23 17:45 /proc/kcore find: ‘/proc/1616/task/1616/fdinfo/6’: No such file or directory find: ‘/proc/1616/fdinfo/5’: No such file or directory. Pretty sure I'm not doing it correctly lol. – 14079_Z Nov 23 '20 at 17:51
0

For me it was logs, but not in /var/logs. They were underneath the root where my docker container was deployed, mounted as volumes.

Noumenon
  • 101
0

AWS Workspace (Linux) user--I fixed this error in my Pycharm IDE by emptying my trash can (lol)

Blair
  • 1