i just beginning to learn some stuff on linux,i have virtual machin on Centos and suddenly my website does not coming up since morning and i get et internal 500 error while trying to login my plesk panel,but after some research and using this command through putty root@vps ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 50G 47G 0 100% / tmpfs 1.0G 0 1.0G 0% /dev/shm

i found out that disk space avail is 0%, i deleted some files at my var/log,after that by and using this command:

du -h --max-depth=1 / | sort -n -r

i find out that my information on the disk is only 1.8G at httpdocs folder while there is a folder at var/lib/php/session that get over 40G of my space!!!!!! what is that thing at all!? How can is fix that? where is the probleme?! thanks


It sounds like your sessions (temporary store of variables when users browse between pages) is not getting cleaned. Have a look at https://stackoverflow.com/questions/654310/cleanup-php-session-files for solutions - in summary BACK UP YOUR SYSTEM (rm commands are always a bit dangerous) and set up a cron job to run every night :

find /var/lib/php/session -type f -atime +7 -exec rm {} \;  

This will find any session files older then 7 days and delete them. (You may want to run this command manually to clean things up for you initially)

  • thank you for reply but its say me;find: paths must precede expression Usage: find [-H] [-L] [-P] [path...] [expression] – Farid Jan 1 '15 at 9:39
  • Ok, try reversing the path and first command so - "find /var/lib/php/session -type f -atime +7 -exec rm {} \; – davidgo Jan 1 '15 at 9:41
  • i tried reversed command and it seems i should wait for the result,nothing happened yet,as there is a millions of file inside that damn folder,is there any faster command ?i mean there is no need to delet files like 7 days old or filtering for deleting just delet most of them instead? – Farid Jan 1 '15 at 9:53
  • Well, you could just delete them all - and it would be slightly faster - but you risk breaking current sessions. The point is there a huge number of files so the filesystem needs to handle them all, and it will take time. I've never tried it and would suggest against it unless you test it first, but I've read that find /var/lib/php/session -type f -atime +7 -delete will work 2-3 times as fast. If you don't care about your data, you might try rm -rf /var/lib/php/session and then mkdir /var/lib/php/session; chown root.apache /var/lib/php/session; chmod 770 /var/lib/php/session – davidgo Jan 1 '15 at 10:00
  • i understand,and i really appreciated your help david thank you ,it seems it doing something now,begining to show million of lines like this; find: /var/lib/php/session/sess_9d3p2ov0emlhe1e73vub0fofn2: No such file or directory find: /var/lib/php/session/sess_s2hibibbdehi699nag0bq04i95: No such file or directory – Farid Jan 1 '15 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.