We help IT Professionals succeed at work.

rm: cannot remove "filename" device or resource busy

usts-pw
usts-pw asked
on
Medium Priority
17,294 Views
Last Modified: 2013-12-16
I am trying to delete files at the command line on my esx server and I keep getting the error:

rm: cannot remove /vmfs/volumes/filename.vmdk: Device or resource busy
Comment
Watch Question

Commented:
I'm thinking that you need to stop the VM that is using that file in order to delete it.  It is being used by at least one of your VM's.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Please check for 2 things,

1.The VM whose file you are trying to delete should not be suspended and
2.The VM should be shutdown so that the lock file is removed on the VMDKs which then enables the VM and its files to be deleted.
nociSoftware Engineer
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
In general lockfiles have little to do with the actual file, they are more a flag so other software knowns that there another process interested in the set of files. Many lockfiles contain a PID of the owning process.
So it certainly won't block deleting a file, it does indicate that there might be a process around that does keep the file open.

Author

Commented:
I am soooo glad that I didn't do this.  I didn't realize that I would have toasted everything had I done it.  Thanks for the suggestion!

Author

Commented:
Thanks all for participating.   Sorry it took so long to respond.  I am busier than ever and I didn't remember that I hadn't remembered to complete this!  Age sucks sometimes~

Author

Commented:
Thanks to all who participated.  Sorry I took so long to complete this.  I am very busy and forgot to complete this.  Thanks again!!

Author

Commented:
Thanks for the help.  Ya know, I can't even close this!!  This is my third try and the screen jumps back to this.  Hope this doesn't show up as my third reply!!  I will hit submit one more time.....

Author

Commented:
Ha.....Ha....LOL.....what a dope!  I see the entries above!  And I have no way to delete them!!  I should go home!!

Commented:
you can use the following:

1.   fuser -km /vmfs/volumes/filename.vmdk
2.   rm -rf  /vmfs/volumes/filename.vmdk

Commented:
npglobal: Thank you very much!

Worked like a charm :)

/mc.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.