Solved

Using find command gives bad directory error in AIX

Posted on 2011-02-20
8
4,695 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
Technology Partners: 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!

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AIX Server 10 91
AIX    Volume group Auto ON/OFF question 2 127
Move nodes from one TSM to another. 3 96
Martian Packets Unix 5 74
In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
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…
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.

696 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