Solved

Using find command gives bad directory error in AIX

Posted on 2011-02-20
8
4,490 Views
Last Modified: 2013-11-17
Hello,
a non-root user is getting the following error when running the below find command.

$ find /center/certsc/cdir -name "worklist*.dat"
find: bad directory </center/certsc/cdir>
$

I believe this might be due to read permissions for the world for /center/certsc please advise
Below are the permissions.

# ls -ld /center/certsc
drwxrwx--x  25 certsc certsc       4096 Aug 02 2010  /center/certsc

# ls -ld /center/certsc/cdir
drwxrwxrwx   2 certsc certsc     102400 Feb 09 08:10 /center/certsc/cdir

Also i was unable to find a file by this name "worklist*.dat" in /center/certsc/cdir
as indicated in the find command above. Could that be causing the error.
Please advise on that as well.
0
Comment
Question by:assistunix
  • 4
  • 3
8 Comments
 
LVL 40

Expert Comment

by:omarfarid
ID: 34940863
did you try to give read perm on /center/certsc dir? I think it is required
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34940994
Hi,

this looks quite as if /center/certsc/cdir were an NFS mount which is broken.

Could it be that the NFS server has problems (FS umounted there, NFS daemon killed or the like)?

Please check with "mount" and also try
ls -l /center/certsc/cdir/*

What do you get? Is the filesystem an NFS mount? Does "ls -l" hang or return errors?

wmp
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34941015
That's to say: Same thing as with your "/mnt/mksysb" issue?
0
 

Author Comment

by:assistunix
ID: 34955970
it is not NFS mounted and i too believe it is a read permission issue, i have made the changes now waiting on customer to verify if it works.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34956176
It's definitely not a permissions issue, because in this case you would have seen
find: 0652-010 The starting directory is not valid.

Unmount the filesystem and run fsck asap.

wmp
0
 

Author Comment

by:assistunix
ID: 35007235
Hello wmp.
you are right as always. I have some more information for you, please take a look at the following info, and confirm if the solution of bad direcotry error is to unmount and run fsck on it.

The errors of find: bad directory </center/certsc/cdir>. only comes to non-root users when they run find command. root user does not get that error and i am getting the same error on other fs as well.

$ find /center/certsc/cdir -name "worklist*.dat"
find: bad directory </center/certsc/cdir>                   <non root error

root / >
# find /center/certsc/cdir -name "worklist*.dat"                      < no error for root
root / >

Permissions:
$ ls -ld /center
drwxr-xr-x  14 root     system         4096 Aug 02 2010  /center

$ ls -ld /center/certsc
drwxrwxr-x  25 certsc certsc       4096 Aug 02 2010  /center/certsc

$ ls -ld /center/certsc/cdir
drwxrwxrwx   2 certsc certsc     102400 Feb 22 00:43 /center/certsc/cdir

Not nfs mounted
$ df -g /center/certsc/cdir
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/cert_userdir      8.00      7.69    4%     1009     1% /center/certsc/cdir

$ mount | grep /center/certsc/cdir
         /dev/cert_userdir /center/certsc/cdir jfs2   Feb 22 00:34 rw,log=INLINE
................

I also ran find command on two other filesystems /center and /center/certsc which are part of the full path of fs above /center/certsc/cdir and are all in same volume group.

and got same find error for non root user and no error for roor user.

I ran two find commands as non-root and as root on /center/certsc
$ find /center/certsc -name data  
find: bad directory </center/certsc/temp>                       <non root error

$ find /center/certsc -name temp
/center/certsc/temp
find: bad directory </center/certsc/temp>                        <non root error

root /center/certsc >
# find /center/certsc -name data
/center/certsc/data                                                  < no error for root
root /center/certsc >

root /center/certsc >
# find /center/certsc -name temp
/center/certsc/temp                                                   < no error for root
root /center/certsc >

# df -g /center/certsc
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/d_certsc      3.00      2.93    3%       41     1% /center/certsc
.........................

find command on /center
$ find /center -name w_standard
/center/w_standard
find: bad directory </center/w_standard>            <non root error

root /center >
# find /center -name w_standard
/center/w_standard                                      < no error for root
root /cerner >

# df -g /center
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/lv_cerner1      5.00      3.89   23%      389     1% /center
...............
all these three filesystems are part of same vg

0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 35007791
Well,

I can't explain why it shouldn't work for non-root users but would work for root, sorry.

What I can see is that you have (at least) three mount levels,
which is of course not a problem per se, as long as the proper mounting sequence is observed.
Maybe something happened/went wrong in that aspect?

I'd suggest the following:
 
Unmount the filesystems "bottom-up", i.e.

- start with /center/certsc/cdir and (if these are also filesystems) /center/certsc/temp, /center/certsc/data until all filesystems at that level under /center/certsc are unmounted. If you have more than three levels you must of course begin at the lowest level!

- Now unmount /center/certsc and  (if applicable) /center/w_standard (unmount filesystems below w_standard first, if present) until everyting at that level under /center is unmounted.

- Finally unmount /center

Mount the filesystems "top-down", i.e.

- Mount /center

- Mount /center/certsc, /center/w_standard (if applicable) until everything at that level is mounted.

- Mount /center/certsc/cdir, /center/certsc/temp, /center/certsc/data until that level is also completely mounted.

- If you have more levels continue until everything is mounted again.

Now retry the "find" commands.

wmp



0
 

Author Comment

by:assistunix
ID: 35152676
Ok, thank you. I haven't yet gotten the outage to unmount it yet. Will try your suggested method and get back to you. Thanks.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now