Search code examples
amazon-web-servicesdelete-filenfsrmamazon-efs

Cannot delete .nfs file inside EFS storage


On the docker image debian:stretch-slim, couldn't delete a specific folder on a NFS drive, using rm -rf /folder-name as root (or rm-rf * after entering the folder-name). Got the following error back:

rm: cannot remove 'test-ikmgfjhv/dev/.nfse47cf31c6b1dd52500000009': Device or resource busy

Solution

  • After a lot of searching, eventually got to the following link:
    https://uisapp2.iu.edu/confluence-prd/pages/viewpage.action?pageId=123962105

    Which Describes exactly why those files exist in NFS and how to handle them. As I wasn't using the same machine the process runs on (another container), so in my case, I had to work around that and first make sure the process using the file is being killed on the first machine, then try to delete it on the second one, according to the project's needs.