Hi for some reason I cannot delete the var/cache folder. Because of it I cannot switch between production > developer mode. When I do get the following:

"The directory "fullurl/var/cache/" cannot be deleted Warning!rmdir(fullurl/var/cache/): Device or resource busy

I tried commands:

umount /var/cache > not permitted  

rm -rf var/cache/ > Device or Resource busy.

  • Does your user have access to said folder? Dec 27 '16 at 15:53
  • This is more of server issue than a Magento one, you likely have a process using the directory. Have you tried to lsof +D var/cache to find out what process this might be? Dec 27 '16 at 19:11
  • Run below command to remove the var/cache folder:

    rm -rf ./var/cache/*

  • Also use this command to remove the pub static.

    rm -rf ./pub/static/*

After run upgrade and deployment command to re-generate that folders.


Try above steps,

Step 1. Give "read-write(recursive)" permission specially to var folder.

Step 2. See that files in /var/report folder are readable

Step 3. Then apply "Delete" on the cache folder


This is probably the cache folder being mounted in tmpfs - which is one of the recommended speed boosts for magento - you had it right to umount it - but you need to find it first, issue:

df -h

Sample cropped output:

none                     2.0G     0  2.0G   0% /home/magentolive/public_html/var/cache

then copy/paste the cache path for umount something like this:

# umount /home/magento/public_html/var/cache

most likely as root - may need to contact you sysadmin and explain. The script should run -- ah but it's not over! need to

mkdir -p /home/magento/public_html/var/cache
otherwise it isn't there to delete. what a cruddy script. just delete the contents of the folder!

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.