[comp.sys.sgi] About the Volume Header

shoshana@pdi.UUCP (Shoshana Abrass) (02/20/91)

  I'm writing my own version of 'hinv'. Having the disk serial #'s appear 
  in the listing would be VERY useful.

  I've been thinking of adding a file to the volume directory in our
  disk's volume headers. It would be a plain ascii file, containing the
  serial number of the disk. I can add the file easily, using dvhtool.

  My questions are: Is it relatively straightforward to access/read the 
  file via /dev/rdsk/dksxdxvh ? and is this something I should be doing? 
  or is this yet another thing which will cause SGI to void my warranty ;).

  I considered putting a file, containing the serial #, on the regular 
  filesystem, but then I have to figure out which partitions are in use 
  before I know where to look for the file.

  -shoshana

  shoshana@pdi.com           <--- Yow! a working MX record!
  pdi!shoshana@sgi.com		 <--- The non-mx record version
  ...uunet!sgi!pdi!shoshana  <--- Old-fashioned mail

----------------------------------------------------------------------
  Disclaimer: SGI is kind enough to let their name appear in my 
  mailpath, but they don't have anything to do with my opinions.
----------------------------------------------------------------------

olson@anchor.esd.sgi.com (Dave Olson) (02/20/91)

In <9102192244.AA12336@koko.pdi.com> shoshana@pdi.UUCP (Shoshana Abrass) writes:
|   I'm writing my own version of 'hinv'. Having the disk serial #'s appear 
|   in the listing would be VERY useful.

You can certainly do this, but if you call it hinv, you may break
SGI programs that use it and expect known output.  If you must
call it hinv, put it in /usr/local/bin, or something like that.

|   I've been thinking of adding a file to the volume directory in our
|   disk's volume headers. It would be a plain ascii file, containing the
|   serial number of the disk. I can add the file easily, using dvhtool.
| 
|   My questions are: Is it relatively straightforward to access/read the 
|   file via /dev/rdsk/dksxdxvh ? and is this something I should be doing? 
|   or is this yet another thing which will cause SGI to void my warranty ;).

The sgilabel file has the serial number in it for some disks, and
the input is pretty free form.  Adding your own file should be
safe, but the volhdr only has room for 16 files, so make sure you
don't put too many files there.  In particular, inst puts a temporary
file there during miniroot installs.

You could simply get the file out with 'dvhtool -v g vhfile file'
if you are doing a shell script.  Otherwise look at sys/dkio.h
and sys/dvh.h.  The format is quite unlikely to change, since
it is known to the CPU prom.
--

	Dave Olson

Life would be so much easier if we could just look at the source code.

daveh@xtenk.asd.sgi.com (02/21/91)

In article <9102192244.AA12336@koko.pdi.com>, shoshana@pdi.UUCP (Shoshana Abrass) writes:
> 
>   I'm writing my own version of 'hinv'. Having the disk serial #'s appear 
>   in the listing would be VERY useful.
> 
>   I've been thinking of adding a file to the volume directory in our
>   disk's volume headers. It would be a plain ascii file, containing the
>   serial number of the disk. I can add the file easily, using dvhtool.
> 
>   My questions are: Is it relatively straightforward to access/read the 
>   file via /dev/rdsk/dksxdxvh ? and is this something I should be doing? 
>   or is this yet another thing which will cause SGI to void my warranty ;).

Not difficult. The volume header contains a 15 entry directory with
entries of the following structure:

#define VDNAMESIZE      8
struct volume_directory {        
	char    vd_name[VDNAMESIZE];    /* name */        
	int     vd_lbn;                 /* logical block number */        
	int     vd_nbytes;              /* file length in bytes */
};

You just have to search this array for a matching name to find where
& how many blocks to read. 

See the file <sys/dvh.h>

Just reading from the volume header partition won't void your warranty. 
(But be careful not to alter any of it, eg the partition table, otherwise
your disk could become inaccessable)!


			Dave Higgen (daveh@xtenk.asd.sgi.com)