I had this problem when an automated test created a ramdisk. The commands suggested in the other answers, lsof
and fuser
, were of no help. After the tests I tried to unmount it and then delete the folder. I was really confused for ages because I couldn't get rid of it -- I kept getting "Device or resource busy"!
By accident I found out how to get rid of a ramdisk. I had to unmount it the same number of times that I had run the mount
command, i.e.
sudo umount path
Due to the fact that it was created using automated testing, it got mounted many times, hence why I couldn't get rid of it by simply unmounting it once after the tests. So, after I manually unmounted it lots of times it finally became a regular folder again and I could delete it.
rm -rf /
... it will happily delete every single file, including /bin/rm.vim unwanted_file
, then simply delete the content inside the file in edit mode, this way i release the disk, but the file is still there.