I'm using OpenVZ to create containers and it creates a folder for each container to store its files. I stopped the creation of a container before it gets completed, so it created a folder for that container, but when I try to remove that folder using rm -rf, I get the 'Device or resource busy' error, but when I do 'lsof <container folder>' or 'fuser <container folder>', it returns nothing, even when I do umount <container folder> nothing happens. So I'm not sure which process or device is using it. How can I remove this folder?

  • Add sudo and see if it removes it! – George Udosen Sep 24 '18 at 12:41
  • Please replace TheFilename with the folder name (keep the surrounding quotes) in env DIR="TheFilename" fgrep "$( df --output=source "$DIR" | tail -1 )" /etc/mtab, run that in a terminal, and edit your question to include the output. – Chai T. Rex Sep 24 '18 at 12:49

I did several umount commands and it worked well for me. For some reason, the folder has been mounted several times by openvz, so I had to umount it several times to be able to remove it.

  • where do you mean to put the comment? – Alex Sep 24 '18 at 16:19
  • Sorry, my fault. You can also mark this post as answer. – abu_bua Sep 24 '18 at 16:21
$ umount /directory/

=> umount(/directory/): Resource busy -- try 'diskutil unmount'

So I tried with

diskutil unmount /directory/

and it works for me.

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.