Article View: comp.unix.shell
Article #1718Re: finding the filesystem of a file
From: david.r.connet
Date: Tue, 06 Nov 1990 19:51
Date: Tue, 06 Nov 1990 19:51
23 lines
1523 bytes
1523 bytes
In article <10243@jpl-devvax.JPL.NASA.GOV>, lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes:
> In article <6500@emory.mathcs.emory.edu> dt@mathcs.emory.edu (Dave Taylor {guest}) writes:
> : > Curious to know if anyone can tell me the fastest way to find out which
> : > filesystem a given file is on if the entire pathname is given.
>
> If you happen to have perl handy, either of the following will work
> (presuming you have no symbolic links):
[some perl examples]
>
> In the absence of perl, your best bet will probably be to look for the longest
> match from /etc/mtab, presuming you have a reasonable one. The following
> works on my /etc/mtab, but is suboptimal:
[shell example]
On some systems, /etc/mtab is known as /etc/mnttab.
Also, on SVR4 systems, [I know this doesn't help you Dave, just throwing
out some additional things] you can use the statvfs() call.
int statvfs(char *path, struct statvfs *buf);
The field buf->f_fstr will give the filesystem name.
Dave Connet
dcon@iwtng.att.com
Technical Details
Message-ID:
<1990Nov6.195105.21043@cbnewsc.att.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!att!cbnewsc!dconReferences:
<6495@emory.mathcs.emory.edu> <6500@emory.mathcs.emory.edu> <10243@jpl-devvax.JPL.NASA.GOV>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!att!cbnewsc!dcon From: dcon@cbnewsc.att.com (david.r.connet) Newsgroups: comp.unix.shell Subject: Re: finding the filesystem of a file Keywords: filesystem search find file Message-ID: <1990Nov6.195105.21043@cbnewsc.att.com> Date: 6 Nov 90 19:51:05 GMT References: <6495@emory.mathcs.emory.edu> <6500@emory.mathcs.emory.edu> <10243@jpl-devvax.JPL.NASA.GOV> Distribution: usa Organization: AT&T Bell Laboratories Lines: 23