1

Please help me how to remove file in session large folder (because inodes used is 100%)

This is my problem

# du -a /var | sort -n -r | head -n 10
13654960        /var
12763132        /var/www
12278932        /var/www/html
12278928        /var/www/html/magento
11416564        /var/www/html/magento/var
7470108 /var/www/html/magento/var/session
3941824 /var/www/html/magento/var/log
3941820 /var/www/html/magento/var/log/system.log
701992  /var/www/html/magento/media
519024  /var/www/html/magento/media/catalog

i can't view file in session folder in ftp

then i run: rm -rf path/var/session/* but not work.

i think because my session folder is large.

Can i get any help and suggestion.

2

to remove old files you need to ssh to the server and type this:

cd /var/www/html/magento/var/session/
find . -name 'sess*' -mtime +7 -exec rm {} \;

it will remove files older than week.

to rotate magento logs use this:
https://magento.stackexchange.com/a/95489/31999

UP
some command variations:

find . -mtime +30 -delete
find . -mtime +30 | xargs rm -Rf
| improve this answer | |
  • Hi MagenX, This is output when i run: /var/www/html/magento/var/session# find . -name 'sess*' -mtime +7 -exec rm {} \; find: cannot fork: Cannot allocate memory please check help me! Thank you! – lethanhkien Jan 11 '16 at 12:07
  • answer updated. see if it helps. – MagenX Jan 11 '16 at 12:27
  • Now, i get output: fork: Cannot allocate memory when i run any command line. and i can't remove any file on vps. Do you think this is issue ram or disk? Thank you! – lethanhkien Jan 12 '16 at 18:22
  • try with a much more consequent number like 1000 instead of 7, and reduce little by little until you reach the desired number of days. – arno Jan 2 at 10:16

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.