Deleting files within the /tmp directory on an ubuntu machine

0

My Symfony website has just started to show the following error:

ErrorException: Warning: session_start(): open (/tmp/sess_4h4kjh4ui4h478h48h44g02,O_RDWR) failed:No space left on device(28) in /var/www/website/symfony/src/symfony/component/HttpFoundation/SessionStorage/NativeSessionStorage.php line 87

I believe this is because the servers /tmp directory is on another partition which is full. What is the best thing to do in this situation? My server never gets rebooted so is there a manual way to delete these files? Or perhaps there is a way to increase its partition size?

Will removing these tmp files stop my website from working?

Richelliot

Posted 2013-05-13T12:02:24.817

Reputation: 101

Duplicate over at Server Fault. – Bobby – 2013-05-13T12:06:34.887

Answers

1

The following command should delete any file in /tmp, name of which is starting with "sess_", created or modified longer than 7 days ago. Any session state file persisting longer than 7 days, is quite unusual in my opinion and deletion of it should not cause any problems. But you should be the judge of how many days worth of those files you want to keep, by changing 7 to some other number in the command:

find /tmp -name "sess_*" -mtime +7 | xargs rm

MelBurslan

Posted 2013-05-13T12:02:24.817

Reputation: 835

I would also recommend moving the session files into a virtual host specific directory and setting up a cronjob to delete them if this is a production server. – Janos Pasztor – 2013-05-15T07:39:52.293