dror@StarConn.com (Dror Matalon) (06/26/91)
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
dcon@cbnewsc.cb.att.com (david.r.connet) (06/26/91)
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. > This is probably quite complex. Especially since a filesystem may reside on more than one partition on more than one disk. Which means the file may actually reside on more than one physical disk! Aren't virtual disks great! (I even put 2 filesystems into 1 partition.) Dave Connet dcon@iwtng.att.com
lance@mpd.tandem.com (Lance Hartmann) (06/26/91)
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.
mouse@thunder.mcrcim.mcgill.edu (der Mouse) (07/01/91)
In article <1991Jun25.174729.11481@StarConn.com>, dror@StarConn.com (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. Right you are: it's machine-dependent at best and impossible at worst. (Suppose it's NFS-mounted from wuarchive.wustl.edu; how do you tell whether they've got that tree on multiple drives?) For that matter, either or both of the files may be on more than one physical device. As a simple example, consider disk striping, which causes some pieces of the file to be on one device and other pieces on others; for another, consider disk mirroring, which causes the file to be entirely present on multiple devices. For that matter, how do you define a physical device? Disk drive? Disk spindle? Disk platter? Disk surface? Disk track? Or the file may be on a RAMdisk, which arguably comes close to not being on any physical device. Why do you care whether they're on the same physical device? der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu