Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete Pesky File

Status
Not open for further replies.
Apr 12, 2001
46
US
How can I delete a dir that is empty that will not go away! I have tried rm -R , rmdir. Everything I can think of. I have changed permissions to make sure that it is root. I have even called IBM. They couldn't figure it out. They suggested unmounting the file system and then trying it b/c it might be in use by something. Any help would be great.
 
What type of errors are you getting when trying to remove the directory? You might have control characters in the directory name.
try rm -Ri *

crowe
 
Hi !

I also faced the same problem. eventhough I use root ID. below is the error message appear. In fact the Dir is empty.

rm: 0653-611 Directory <file name> is not empty.


Thanks

Regards
 
Can you run fsck against the filesystem to ensure that all superblock info, etc. is correct..?

Just an idea.
 
This normally occurs when there are files still in the directory - perhaps a hidden . file

From the parent directory enter rm -fr <directoryname> and this will delete the contents of the directory as well

Take great care with this, but thats the way i'd do it

John
 

Hi John,

still same error occured.

$rm -fr <filename>
rm: 0653-611 Directory <filename> is not empty.
$whoami
root
$


Thanks
 
what are the permissions on the directory + owner/group

can you rename the directory

if you cd into the directory and do a ls -laF

what do you get ?
 


Hi John,

Here is the snapshoot for your referance.

$ ls -l <filename>
drwxrwsr-x 2 root sys 4096 Aug 29 09:38 <Filename>

$cd <filename>
$ls -laF
drwxrwsr-x 3 root sys 4096 Aug 29 09:38 ./
drwxrwsrwx 9 root sys 1024 Aug 31 15:20 ../

Thanks
 
can you do an 'id' instead of whoami, and check root is part of the sys group

I guess that you are not using ACL's

have you logged in as root - or su'd -

try doing an ls -lb to display any strange characters in a filename
 
If there is a deleted file in that directory that is being held open by another process you will not be able to remove the directory. Deleted files don't actually go away until there are no links to them.

Or -- if a process is using that directory as its working direcory you will have problems.

Use the [tt]fuser[/tt] command to find the PID and user name of the process that is using the directory.
Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 

mike & John,

Problem still exits. It seems no links available (fuser command)to this DIR.

FYI, I'm use root ID for this exercise and no strange char in this DIR. (ls -lb)

Thanks

 
Why not try running fsck against the filesystem to correct any incorrect superblock / inode information..?
 

vickersdc,

OK. I will follows your instruction and let you know the status.

Thanks
 

vickersdc,

Sorry for late reply,

an error occured when issue fsck command.So, what is the next step ?

$fsck /dev/lvuv1
Filesystem Helper: 0506-519 Device open failed
$

Thanks
 
It sounds corrupt.....if you can unmount the lv and run fsck -y maybe it will fix itself.
If not.......you can try below......or you may have to delete it and recreate it........
if it is empty, it is no big deal right?

0506-519
Device open failed
Possible Causes

You tried to mount or unmount a file system that may be damaged.
You ran the ff or fsck command on a file system after modifying the
/etc/filesystems file and specifying an incorrect device.
You attempted to run the fsck command on a cdrfs (CD-ROM) file system.

Procedures for Recovery

Run the fsck FileSystem command on the file system to check whether there
are errors in the output.

1.If the fsck output displays errors, reboot the system from the boot media.
Select the Maintenance option,
then select Access a Root Volume Group.

2.After identifying the correct volume group, select Access this Volume Group
and start a shell before mounting filesystems.

3.Run the fsck command on all the file systems, including the damaged one.

4.Enter exit after all the file systems are checked.


5.Shut down the system:
shutdown -Fr

Ensure that the device specified in the /etc/filesystems file is correct, or use SMIT to
remove and then recreate the file system.

Check the /etc/filesystem file for the FileSystem stanza. If the vfs field is crdfs,
do not run the fsck command.

 
Are you using HACMP on this system? If so, you cannot simply remove the directory if it is a mount point. The procedure is in the Admin Guide for removing share filesystems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top