• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5200
  • Last Modified:

Using find command gives bad directory error in AIX

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
assistunix
Asked:
assistunix
  • 4
  • 3
1 Solution
 
omarfaridCommented:
did you try to give read perm on /center/certsc dir? I think it is required
0
 
woolmilkporcCommented:
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
 
woolmilkporcCommented:
That's to say: Same thing as with your "/mnt/mksysb" issue?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
assistunixAuthor Commented:
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
 
woolmilkporcCommented:
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
 
assistunixAuthor Commented:
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
 
woolmilkporcCommented:
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
 
assistunixAuthor Commented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now