Score:0

How to force delete directory backed by Gluster that will not delete even when using -r option

cn flag

Hi trying to delete a directory and no mater what I try I get: rm: cannot remove 'wont_delete/delete': Directory not empty

I'm running sudo rm -vr wont_delete/

The directory is on gluster fs.

Edit: Also tried sudo rm -vrf wont_delete/

Score:0
pe flag

Try with this rm with the options r and f

rm -rf wont_delete/

-r, -R, --recursive remove directories and their contents recursively

-f, --force ignore nonexistent files, never prompt

UPDATE

Reference: Unable to remove directory from GlusterFS volume mount point , Why ?, this solution is verified by Red Hat

Issue

  • Unable to remove directory from GlusterFS volume mount point

  • Why some files and directories are missing from GlusterFS volume mountpoint but they are available in bricks?

  • Unable to delete folders in gluster

  • Cannot remove directory (rm -rf)


rmdir: failed to remove `testdir`': Directory not empty"

Logs


W [client-rpc-fops.c:695:client3_3_rmdir_cbk] 0-volname-client-0: remote operation failed: Directory not empty

W [client-rpc-fops.c:695:client3_3_rmdir_cbk] 0-volname-client-1: remote operation failed: Directory not empty

Resolution

Upgrade the cluster to Red Hat Gluster storage 3.2

Root Cause

This can happen due to multiple issues. But the main reason is due to a stale directory or stale link_to_file exists in any of the brick of the volume.

Diagnostic Steps

rmdir: failed to remove `testdir`': Directory not empty"
  • Check all the bricks for this directory , here for example testdir and see if this directory is empty or not in all the bricks.

  • Most probably this directory will be having some files and directories in some of the bricks.

  • Remove gfidlink to this Directory or file from .glusterfs directory.

  • Important Note Perform delete only when data inside this directory is not important .

There is another reference How to remove a directory from a gluster volume when rmdir unexpectedly fails with "directory not empty", verified by Red Hat

cn flag
Still the same.
Arden Smith avatar
pe flag
Check my update
cn flag
Can I manually remove the folder from the actual brick?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.