any util that given a file name tells you what file system its on?

any util that given a file name tells you what file system its on?

Post by John R. Vanderpoo » Fri, 04 Oct 1996 04:00:00



is there any irix util that given a file name tells you what file system its
on?  or a script or something....

so i tried to roll my own, and the stat man pages says:

     st_dev    This field uniquely identifies the file system that contains
               the file.  Its value may be used as input to the ustat system
               call to determine more information about this file system.  No
               other meaning is associated with this value.

so i do that and pass it to ustat, and the ustat man page says:

          daddr_t   f_tfree;       /* Total free blocks */
          ino_t     f_tinode;      /* Number of free inodes */
          char      f_fname[6];    /* Filsys name */
          char      f_fpack[6];    /* Filsys pack name */

and the two char fields are always blank - call is completing ok, good retval,
and f_t* fields are filled in, even if the f_f* fields were filled in what
good would just 6 chars be anyway...  i then tried statvfs() too since ustat
deprecates to it, but it gets me nowhere too.

                        fish
--
what a beautiful world this will be,
 what a glorious time to be free.       IGY


 
 
 

any util that given a file name tells you what file system its on?

Post by Paul Jacks » Fri, 04 Oct 1996 04:00:00


|> is there any irix util that given a file name
|> tells you what file system its on?

How about:

        df `dirname /etc/passwd` | sed 1d | awk '{print $1}'

  (using the file "/etc/passwd" for example).

Or how about, from C, using something like: getmountid(2),
followed by the following sort of loop (taken from df.c):

        if ((mtabp = setmntent(MTAB, "r")) == NULL)
                return NULL;
        while ((mntp = getmntent(mtabp)) != NULL) {
                if (strcmp(mntp->mnt_type, MNTTYPE_IGNORE) == 0)
                        continue;
                if (getmountid(mntp->mnt_dir, &mnt_mid) < 0)
                        continue;
                if (bcmp(midp, &mnt_mid, sizeof(mountid_t)) == 0)
                        return mntp;
        }
        endmntent(mtabp);

where "midp" is the mountid_t returned by getmountid().

--

The first of these suggestions (df `dirname ...) I just did,
so I believe works.  The second is just from glancing at
code for two minutes, so could be way off the mark.
--

                                I won't rest till it's the best ...
                                Software Production Engineer


 
 
 

any util that given a file name tells you what file system its on?

Post by Dave Ols » Sat, 05 Oct 1996 04:00:00



| is there any irix util that given a file name tells you what file system its
| on?  or a script or something....

What's wrong with devnm?
        00:59 ficus4DACE1_N32anchor197 devnm /sbin/date
        /dev/dsk/dks0d1s0 /sbin/date
(if you want the mount point, just use the devnm output and grep for
that in the output from the mount command, or if you like living
dangerously, from /etc/mtab).

| so i do that and pass it to ustat, and the ustat man page says:
|
|           daddr_t   f_tfree;       /* Total free blocks */
|           ino_t     f_tinode;      /* Number of free inodes */
|           char      f_fname[6];    /* Filsys name */
|           char      f_fpack[6];    /* Filsys pack name */
|
| and the two char fields are always blank - call is completing ok, good retval,

Only set by the labelit command, and only for efs.  Otherwise blank.
--

Dave Olson, Silicon Graphics   Guru and busybody at large

 
 
 

any util that given a file name tells you what file system its on?

Post by Vladimir Marukhlen » Sat, 05 Oct 1996 04:00:00



[...]

Quote:>What's wrong with devnm?
>    00:59 ficus4DACE1_N32anchor197 devnm /sbin/date
>    /dev/dsk/dks0d1s0 /sbin/date

[chaos]~> df /usr/users8/vlad8/tmp/gsfaq.txt
Filesystem                 Type  blocks     use   avail %use  Mounted on
mozart:/usr/users8          nfs 2042091 1860925  181166  91%  /usr/users8
[chaos]~> devnm /usr/users8/vlad8/tmp/gsfaq.txt
/usr/users8/vlad8/tmp/gsfaq.txt not found

--

 
 
 

any util that given a file name tells you what file system its on?

Post by Dave Ols » Mon, 07 Oct 1996 04:00:00


| >What's wrong with devnm?
| >  00:59 ficus4DACE1_N32anchor197 devnm /sbin/date
| >  /dev/dsk/dks0d1s0 /sbin/date
|
| [chaos]~> df /usr/users8/vlad8/tmp/gsfaq.txt
| Filesystem                 Type  blocks     use   avail %use  Mounted on
| mozart:/usr/users8          nfs 2042091 1860925  181166  91%  /usr/users8
| [chaos]~> devnm /usr/users8/vlad8/tmp/gsfaq.txt
| /usr/users8/vlad8/tmp/gsfaq.txt not found

Now *that's* peculiar, particularly since df and devnm are the same
binary.  Perhaps one of the dirs along the route up to / doesn't have
general read or search permissions?  Does /sbi/pwd in /usr/users8/vlad8/tmp
work?
--

Dave Olson, Silicon Graphics   Guru and busybody at large

 
 
 

any util that given a file name tells you what file system its on?

Post by Vladimir Marukhlen » Tue, 08 Oct 1996 04:00:00




>| >What's wrong with devnm?
>| >      00:59 ficus4DACE1_N32anchor197 devnm /sbin/date
>| >      /dev/dsk/dks0d1s0 /sbin/date
>|
>| [chaos]~> df /usr/users8/vlad8/tmp/gsfaq.txt
>| Filesystem                 Type  blocks     use   avail %use  Mounted on
>| mozart:/usr/users8          nfs 2042091 1860925  181166  91%  /usr/users8
>| [chaos]~> devnm /usr/users8/vlad8/tmp/gsfaq.txt
>| /usr/users8/vlad8/tmp/gsfaq.txt not found

>Now *that's* peculiar, particularly since df and devnm are the same
>binary.  Perhaps one of the dirs along the route up to / doesn't have
>general read or search permissions?  Does /sbi/pwd in /usr/users8/vlad8/tmp
>work?

[chopin]tmp>  /sbin/pwd
/usr/users8/vlad8/tmp

[chopin]tmp> devnm /usr
/dev/dsk/dks0d1s0 /usr

[chopin]tmp> devnm /usr/users8
/usr/users8 not found

[chopin]tmp> df /usr/users8
Filesystem                 Type  blocks     use   avail %use  Mounted on
mozart:/usr/users8          nfs 2042091 1860925  181166  91%  /usr/users8

[chopin]tmp> ls -ld / /usr /usr/users8
drwxr-xr-x   23 root     sys         1024 Aug 26 13:07 /
drwxr-xr-x   56 root     sys         1024 Oct  4 15:00 /usr
drwxr-xr-x    8 root     sys          512 May 10 14:54 /usr/users8

[chopin]~> uname -sr
IRIX 5.3

The same happens in IRIX 5.2.
devnm doesn't like nfs, df does :)

--