Solved

Using find command gives bad directory error in AIX

Posted on 2011-02-20
8
4,440 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

760 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

23 Experts available now in Live!

Get 1:1 Help Now