Path: utzoo!utgpu!watserv1!watmath!att!pacbell.com!mips!sgi!shinobu!odin!anchor!olson From: olson@anchor.esd.sgi.com (Dave Olson) Newsgroups: comp.sys.sgi Subject: Re: bug in reading from disk partitions Message-ID: <1990Nov29.175220.5610@odin.corp.sgi.com> Date: 29 Nov 90 17:52:20 GMT References: <1990Nov27.031543.16150@alias.uucp> <76400@sgi.sgi.com> Sender: news@odin.corp.sgi.com (Net News) Organization: Silicon Graphics, Inc. Mountain View, CA Lines: 31 In <76400@sgi.sgi.com> jeremy@perf2.asd.sgi.com (Jeremy Higdon) writes: | In article <1990Nov27.031543.16150@alias.uucp>, chk%alias@csri.toronto.edu (C. Harald Koch) writes: | > | > If it were important, I would like to write a program to figure out the size | > of the partition and copy exactly the right amount of data, but I don't know | > how to figure out the raw size of a partition. Can anyone at SGI tell me how | > to do this? | > | | The partition information is in the disk label (the first 512 bytes of | the volume header (??????vh) partition). See /usr/include/sys/dvh.h and | vh(7m) for more info. | Also see the ioctls in sys/dkio.h. In particular, look at DIOCGETVH, which will return the volume header info for you. It is recommended that you use the ioctl rather than reading the volume header info directly, because some of the drivers will patch up the volume header info when first opened, if it appears unreasonable (e.g., with SCSI, if the partition size plus its offset is greater than the drive capacity as returned by the SCSI readcapacity operation. The DIOCGETVH ioctl takes as the 3rd argument a pointer to a struct volume_header. You must be using the character device for the ioctl to work. -- Dave Olson Life would be so much easier if we could just look at the source code.