I could really use some help. I have a Ubuntu 14.04.6 account with DigitalOcean and am encountering some errors related to lack of space. When I ssh into the account and do a tab-completion at the command line, I get the error:
bash: cannot create temp file for here-document: No space left on device
If I run df -h
I get
Filesystem Size Used Avail Use% Mounted on
udev 233M 4.0K 233M 1% /dev
tmpfs 49M 876K 49M 2% /run
/dev/vda1 20G 8.2G 11G 44% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 5.0M 0 5.0M 0% /run/lock
none 245M 0 245M 0% /run/shm
none 100M 0 100M 0% /run/user
However, if I do df -i
I get
Filesystem Inodes IUsed IFree IUse% Mounted on
udev 59582 404 59178 1% /dev
tmpfs 62700 334 62366 1% /run
/dev/vda1 1310720 1310720 0 100% /
none 62700 3 62697 1% /sys/fs/cgroup
none 62700 4 62696 1% /run/lock
none 62700 1 62699 1% /run/shm
none 62700 2 62698 1% /run/user
and I get all sorts of space errors when I try to do various tasks.
I figured the issue was something related to /dev/vda1
. Upon searching the issue online, it seemed that this was related to PHP sessions files not deleting. Indeed, I tried:
ls -l /var/lib/php
total 66772
drwxr-xr-x 3 root root 4096 Mar 16 2019 modules
drwx-wx-wt 2 root root 68366336 Dec 29 04:27 sessions
I understand I need to dig into the automated cron tasks and figure out why things are not being deleted. However, firstly I need enough space to actually do some work. But I'm at my wits end of how to delete the contents of this folder. I've tried:
sudo find /var/lib/php/sessions -name "sess_*" -exec rm {} \;
sudo find /var/lib/php/sessions -type f -delete
sudo sh -c "rm -rf /var/lib/php/sessions/*"
None of them seem to do anything upon issuing the command.
Update 14 Mar 2020: I encountered this error again, and again I had difficulty deleting the files. However, at the very least I found a solution to the deletion problem [3]. The solution is to use rsync to delete. I did the following
cd /var/lib/php
sudo mkdir emptydir
rsync -a --delete /var/lib/php/emptydir/ /var/lib/php/sessions/
Source:
[1] PHP session directory full?