Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!devnull!lance From: lance@mpd.tandem.com (Lance Hartmann) Newsgroups: comp.unix.wizards Subject: Re: How do you determine what physical device a file in on? Summary: Finding physical device for filename Keywords: FILE STAT DEV Message-ID: <338@devnull.mpd.tandem.com> Date: 26 Jun 91 13:27:56 GMT References: <1991Jun25.174729.11481@StarConn.com> Sender: news@devnull.mpd.tandem.com Organization: Tandem Computers (MPD) Austin, TX Lines: 26 In article <1991Jun25.174729.11481@StarConn.com> dror@starnet.UUCP (Dror Matalon) writes: > > I suspect that there are only machine dependent ways. Given >two files x and y. I want to determine if they're on the same PHYSICAL devie. >(It's pretty easy to find out the logical device, you do an statfs on the >file). Is there a portable or a semi-portable way to do this or do I need to >go into every machine's disk drivers structures to find out. > > >Thanks > > Dror While perhaps machine dependent, I've found you can do a stat() on the filename and look at the "st_dev" member of the "struct stat" ptr. According to 'our' man pages (I'm on a Tandem S2 - using "mips" UNIX), st_dev is "I.D. of device containing a directory entry for this file." Unfortunately, this can be a LOGICAL device since Tandem's S2 supports mirrors. But, alas, you can determine whether or not that dev no. is a mirror and figure out the actual physical disk partitions that the mirror is accessing. -- Lance G. Hartmann - cs.utexas.edu!devnull!lance (Internet) ------------------------------------------------------------------------------- DISCLAIMER: All opinions/actions expressed herein reflect those of my VERY OWN and shall NOT bear any reflection upon Tandem or anyone else for that matter.