[Cialug] Unable to remove a directory in RedHat7

Tom Sellers tomsellers2001 at yahoo.com
Thu Aug 21 18:49:11 CDT 2014


I have had the file structure checked with nothing found.  I tried both commands given below with no results.  

Here is the response from the ls -Rla command.

[root at tomcansv V6]# ls -Rla
. :
total 12
drwxrwxrwx        3 tsellers tsellers                  4096  Sep 20 11:34   .
drwxrwxrwx        3 tsellers tsellers                  4096  Oct  13   2009  ..
drwxrwxrwx        3 tsellers tsellers                  4096  Sep 20 15:10    Portal

./Portal:
total  8
drwxrwxrwx        3 tsellers tsellers                  4096  Sep 20 15:10   .
drwxrwxrwx        3 tsellers tsellers                  4096  Sep 20 11:34   ..
[root at tomcansv V6]# 

 
 From: Zachary Kotlarek <zach at kotlarek.com>
To: Central Iowa Linux Users Group <cialug at cialug.org> 
Sent: Thursday, August 21, 2014 5:29 PM
Subject: Re: [Cialug] Unable to remove a directory in RedHat7
  



On Aug 21, 2014, at 2:29 PM, Tom Sellers <tomsellers2001 at yahoo.com> wrote:

> I have been trying to clean up my old linux box that I used as a server and make sure I did not leave anything on there important.  In the process of doing so I have run into a directory that I can't delete.  It says it is not empty but I am unable to see any files in that directory when I am logged on as the root user.  
> 
> Is there a way to remove the directory regardless of whether there are any hidden files in it?
> 
> I tried a command I found on line rm -rf filename but that does not work.  Just tells me directory is not empty.


To start with a simple:
    ls -Rla <path>
should show you everything in the directory, including hidden files. If that doesn’t show anything it’s unlikely the problem is really the contents of the directory.

Other reasons the directory may not be able to be deleted include:
1. It’s in use by some process. You can determine which with the command:
    lsof | grep <path>
which will show any processes that have matching paths open by any means.

2. The directory or something in it may be marked immutable. You can clear that with:
    chattr -R -i <path>
which recursively clears the immutable flag on everything under <path>.

3. The filesystem itself is corrupt. This is unusual but can sometimes lead to files/directories that cannot be manipulated in the usual ways. `fsck` should be able to tell you if that’s the case — just remount the disk read-only and force a full scan.

    Zach

_______________________________________________
Cialug mailing list
Cialug at cialug.org
http://cialug.org/mailman/listinfo/cialug


More information about the Cialug mailing list