1838579 Members
3705 Online
110128 Solutions
New Discussion

Re: Unknown directory

 
SOLVED
Go to solution
TWBSupport
Regular Advisor

Unknown directory

With some issues that I was having earlier and are now fixed, I found some odd issues on my system that I want to resolve, do some housecleaning, if you will.

I have a 'ghost' directory off root.
dr-xr-xr-x 28 bin bin 8192 Apr 1 2003 var
drwxrwxrwx 2 root sys 96 Apr 25 2003

The bottom one is what I am talking about. How can I investigate what this is, it doesn't have a name. I'm sure it's nothing, but I want it off the server.
15 REPLIES 15
Mel Burslan
Honored Contributor

Re: Unknown directory

run

ls -b

to see the non-printable characters in the file/directory names.
________________________________
UNIX because I majored in cryptology...
TWBSupport
Regular Advisor

Re: Unknown directory

thank you!

\177\177\177\177

How do I get into it? I can't cd into it.
Patrick Wallek
Honored Contributor

Re: Unknown directory

Try doing an 'ls -labi'.

That will list everything, include its inode number at the beginning of the line and if there are any non-printable characters in the dirctory name, it will print the octal value of those characters.

Based on that you could then do a

# find . -inum |xargs ll

to make sure you just get the one directory. And then to delete it:

# find . -inum | xargs rm

(Where is the inode number returned from the above ls command.)
Marvin Strong
Honored Contributor

Re: Unknown directory

ll -b or ll | vis

should show you want character are the directory name. so you can see whats in there or delete it.
Jeff_Traigle
Honored Contributor

Re: Unknown directory

You can also do "ls -il" to find out the inode of the directory. Then use find to rename it to something else so you can more easily investigate what's inside before taking further action:

find . -prune -inum X -exec mv {} newname \;
--
Jeff Traigle
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Unknown directory

cd /
ls -i # this will list the inodes; find the one associated with your bogus directory
let's say it is inode 1234

next,
find . -xdev -type d -inum 1234 -exec rmdir {} \;


I would first use a safe command such as "-exec ls -l {} \;" to make sure your find filter is just right.
If it ain't broke, I can fix that.
James R. Ferguson
Acclaimed Contributor

Re: Unknown directory

Hi Denda:

It would appear that the directory beneath '/var' has a name with unprintable characters. Do:

# ls -il /var

This will give you the inode number of the directory in question as the left-most field. Now do:

# find /var -xdev -inum -exec rm -ri {} \;

...where is the inode (number) determined from the 'ls'.

Too, this will require you do answer "y" to remove any files under the directory and/or the directory itself.

Regards!

...JRF...
Regards!

...JRF...
Jonathan Fife
Honored Contributor

Re: Unknown directory

'man ascii' shows \177 is a delete character, so try "cd "

Decay is inherent in all compounded things. Strive on with diligence
TWBSupport
Regular Advisor

Re: Unknown directory

Hmmm.. Here's the output
2305 drwxrwxrwx 2 root sys 96 Apr 25 2003 \177\177\177\177
# find . -inum 2305 |xargs ll
-rw-rw-rw- 1 p053p13 2750 1794 Dec 15 2004 ./home/tw053p13/consolid28014.lis
-r--r--r-- 1 bin bin 279 Aug 5 2002 ./opt/apache/icons/generic.sec.png
-rwxrwxrwx 1 ediuser 2750 1310 Aug 2 13:05 ./tmp/thy.D060802.T130501.log
-rw-r----- 1 avl dba 106029 Jan 5 2004 ./u06/avl/custom/payroll/data/Payroll.Hour.
D010504.T095833.dat
-rw-rw-r-- 1 edi edi 80752 Apr 5 2005 ./u34/gentran/maps/997ignr2.TBL
-r--r--r-- 1 bin bin 740 Nov 14 2000 ./usr/lib/nls/msg/ja_JP.SJIS/expreserve.cat
-r--r--r-- 1 root sys 2998 Nov 15 2000 ./var/adm/sw/products/Xserver/pfiles/INDEX

./u01/app/oracle/product/9.2.0/inventory/filemap/javavm/jahome:
total 4
-rw-r--r-- 1 oracle dba 1762 May 30 2005 files.map

./u61/oradata/disk1/stage/Queries/generalQueries/2.2.0.7.0:
total 0
drwxr-xr-x 2 root sys 96 Jun 23 2003 1

./:
total 0

Shouldn't the inode only be associated with the one directory?
Thanks for your help.
Patrick Wallek
Honored Contributor

Re: Unknown directory

Inode numbers are unique to each FILESYSTEM.

If you ran your find from the / (root) directory then you will find all occurrences of inode 2305 among ALL filesystems on your machine.
Jonathan Fife
Honored Contributor

Re: Unknown directory

You need to add an -xdev to the find command, or it will search all filesystems from the directory specified (in your case, the root dir) and not just the one specified.

In any case, from the last bit of output it appears that directory is empty and you can use one of the rm commands above.
Decay is inherent in all compounded things. Strive on with diligence
James R. Ferguson
Acclaimed Contributor

Re: Unknown directory

Hi Denda:

Using the inode number you determined to match your directory, you need to do:

# find / -xdev -inum -exec rm -ri {} \;

That is, your directory is "off root" as you say, just like '/var' is "off root".

You *must* use '-xdev' as I show(ed) since you do *not* want to cross mountpoints. Inodes are only unique within filesystems, so you must be very careful to select exactly what you want!

Regards!

...JRF...
TWBSupport
Regular Advisor

Re: Unknown directory

Good gracious.. What am I typing wrong? I wanted to take Clay's advice and make sure the filter is correct, but I get the following error.

find / -xdev -inum 2305 -exec ls -l {}\;
find: -exec not terminated with ';'

Thank you all for your patience.
A. Clay Stephenson
Acclaimed Contributor

Re: Unknown directory

The between {}\; is all important. Bear in mind that when you do an ls of a directory, you will also see any files under that directory.
If it ain't broke, I can fix that.
TWBSupport
Regular Advisor

Re: Unknown directory

Thank you all for your help.