From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 25-OCT-1989 15:18
To:	MRGATE::"ARISIA::EVERHART"
Subj:	RE: Re: Extending INDEXF.SYS

Received: From CITHEX.CALTECH.EDU by CRVAX.SRI.COM with TCP; Wed, 25 OCT 89 11:16:17 PDT
Received: from soltmp.span by CitHex.Caltech.Edu with VMSmail ;
	Wed, 25 Oct 89 11:20:52 PDT
Date:    Wed, 25 Oct 89 11:20:52 PDT
From: carl%soltmp.span@CitHex.Caltech.Edu (Carl J Lydick)
Message-Id: <891025112052.1d44@CitHex.Caltech.Edu>
Subject: RE: Re: Extending INDEXF.SYS
To: info-vax@CitHex.Caltech.Edu
X-St-Vmsmail-To: CITHEX::INFO-VAX

 > Backup has not been able to preserve header allocation in  the  index  file
 > from  day  one.  It always allocates just enough headers to hold the files.
 > Any careful  planning  we  do  to  pre-allocate  enough  headers  to  avoid
 > extending  the  index  files  goes down the tubes when the disk is restored
 > using BACKUP/IMAGE.  The only solution  I  know  of  is  to  restore  using
 > /NOIMAGE  to a just initialized, mounted disk.  There was a rumor that this
 > rather irritating behavior of backup might be fixed in version 5.x.  Anyone
 > know for sure?

It strikes me that this is a non-problem.  First, realize that  INDEXF.SYS  is
NEVER  a  CONTIGUOUS  file  (this has to do with the fact that it contains the
disk's HOME BLOCK, BACKUP HOME BLOCKS, and a few other special blocks  on  the
disk.  It is CONTIGUOUS BEST TRY.  OK, you've just done an image backup to the
disk.  That means that it's defragmented, so if you extend  the  file  (easily
done with RMS; see sample program below), the extension  will  be  contiguous.
INDEXF.SYS has the FCS record structure, with the FCS end of file mark set  to
the last file header ever used, and when you try to use a higher header number
than that, the initial contents of of that header are  ignored,  so  extending
the  index  file  yourself  instead of letting the ACP do it won't confuse the
file system.  Thus, the solution to the problem is:
    1)  Do your image backup;
    2)  Mount the disk privately
    3)  Define EXTEND as a foreign command or use MCR and invoke it  with  the
        arguments:
            disk:[000000]INDEXF.SYS
            numberofadditionalblockstoallocate
    4)  Dismount the disk and remount it as you normally would.
The comments regarding INDEXF.SYS should be taken with the caveat that this is
subject  to  change  by  DEC without notice, but that eventuality seems pretty
unlikely.

/******************************************************************************\
 * EXTEND.C -- Increase a file's allocation				      *
 *   Usage:								      *
 *	EXTEND filename blocks_to_allocate				      *
\******************************************************************************/
#include stdio
#include rms
main(nargs, args)
int nargs;
char **args;
{	struct FAB fab;
	long sts;

	fab = cc$rms_fab;
	fab.fab$b_fac = FAB$M_PUT;
	fab.fab$b_shr = FAB$M_SHRPUT;
	fab.fab$l_fna = *++args;
	fab.fab$b_fns = strlen(fab.fab$l_fna);
	if (((sts = sys$open(&fab,0,0)) & 7) != 1)
		exit(sts);
	fab.fab$l_alq = atol(*++args);
	exit(sys$extend(&fab,0,0));
}

