So this morning, I noticed I was having trouble using tab-completion while logged into ssh. I received a cannot create temp file for here-document: No space left on device message whenever I attempted a tab-completion.
Confused by the “no space left” message when I was using less than 30% of the disk space on the device, I dug into it a little deeper and realized the lack of available “inodes” was actually the problem.
I managed to clear enough files manually to run the following command: sudo find / -xdev -printf '%h\0' | sort -z | uniq -cz | sort -nrzk 1 | tr '\0' '\n' | head -n 50
That revealed the biggest culprit to be PHP and HHVM session files (FWIW, I don’t use HHVM anymore).
1261734 /var/lib/php5 543376 /var/lib/hhvm/sessions
I’d love to clear these out (especially the HHVM ones) but am not sure of the proper way to do it.
Any advice would be much appreciated.
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!
This one solves my problem on my php7 A quick command to delete all sess_* files on /var/lib/php/sessions is this: find /var/lib/php/sessions -type f -cmin +24 -name “sess_*” -exec rm -f {} ; Reference: http://www.queryadmin.com/1634/bash-script-delete-php-session-files-free-inodes/
For php5 you can try this one: https://pim.famnit.upr.si/wordpress/index.php/2011/04/20/running-out-of-inodes-no-space-left-on-device-php-not-cleaning-sessions/
On Ubuntu there should be a cron job configured to delete unused session files on a regular basis located in /etc/cron/php5.
Running out of inodes just means that you have too many files. If you are no longer using hhvm you can simply delete those files (or uninstall unneeded software) to free them up.
Hello, all
You can clear the session files using the find command. You can navigate to the session save path and execute the command:
find . -type f -name 'sess_*' -delete
This will delete all files which name start with sess_ you can adjust this if the session files have a different name.
Please be extra careful when executing commands that delete your data and make sure that you’re in the proper directory.
Regards, Alex
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.