?
Solved

Using find command gives bad directory error in AIX

Posted on 2011-02-20
8
Medium Priority
?
4,939 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 

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
 
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 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month12 days, 15 hours left to enroll

777 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