Page 1 of 1

/home/admin/tmp using up too much space/inodes

Posted: Sun Nov 27, 2016 9:41 am
by prxbl
I noticed my Ubuntu 14.04 web server stopped serving pages because it had no more disk space left for caching so i started looking for the issue.

Code: Select all

root@domain:/# df -h
Filesystem                 Size  Used Avail Use% Mounted on
udev                       487M  4.0K  487M   1% /dev
tmpfs                      100M  388K  100M   1% /run
/dev/disk/by-label/DOROOT   30G   21G  7.0G  75% /
none                       4.0K     0  4.0K   0% /sys/fs/cgroup
none                       5.0M     0  5.0M   0% /run/lock
none                       498M     0  498M   0% /run/shm
none                       100M     0  100M   0% /run/user
I seem to have some free space on disk, let's check inodes.

Code: Select all

root@domain:/# df -i
Filesystem                 Inodes   IUsed  IFree IUse% Mounted on
udev                       124520     402 124118    1% /dev
tmpfs                      127234     374 126860    1% /run
/dev/disk/by-label/DOROOT 1966080 1965882    198  100% /
none                       127234       2 127232    1% /sys/fs/cgroup
none                       127234       2 127232    1% /run/lock
none                       127234       1 127233    1% /run/shm
none                       127234       2 127232    1% /run/user
I seem to be using them all so I checked which directory is using the most and I found:

Code: Select all

root@domain:/# find / -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n
1781695 /home/admin/tmp
Is it okay to just delete everything inside tmp? but before doing that how can I find out what caused the issue to prevent it from happening again?

When I try to list the tmp directory, I'm just seeing a bunch of files called "sess_g0ks0nh06o2h243bjka4b3cvq1" . These look to be session files for my opencart online shop. I've been running the server for about 1 year now, is this normal to happen over time and I need to clear that directory manually?

Thank you

Re: /home/admin/tmp using up too much space/inodes

Posted: Mon Nov 28, 2016 1:19 pm
by skurudo
You can delete all sessions insid tmp via command

Code: Select all

find /home/*/tmp -type f -name 'sess_*' -ctime +5 -delete
And you can make script and add it to cron.. ;-)

Re: /home/admin/tmp using up too much space/inodes

Posted: Wed Jun 27, 2018 10:52 am
by Wiizard
How to create a cron from this

Many thanks