@(#)newfsall.doc	1.2	93/12/07

###########       Newallfs  - newfses files systems ###################

    Requirements:
    
    Each file system must:
      1) be in the /etc/checklist equivalent.
      2) Contain no other files then . .. lost+found and CL[0-9]* in the
      uppermost directory.
      3) Be mounted.
      4) Have a special file that exists and can be derived from the
      mountpoint.

      The user must know the root password or have access to an  account
      with root capability.  An su command will be issues and if this is
      a non-root user a password will be required.  A different user 
      may be used but it must have UID=0.  Use the $ROOTUSER var to
      change.

      If the SUT is a remote system, then it's $SUTNAME should contain
      it's name and you must be able to rlogin to it as root.

    
    Variables
      
    The script newfsall automates the process of newfsing files systems
    before a LADDIS run.  It is general purpose, so it may be used in other
    contexts, however, LADDIS is it's life.  
   
    Newfsall requires that information be passed to it via environment
    variables.  At least two are required:
      
      DISK_TYPE - is the string required by the newfs command on your
                  system (see below).  
      
      SUT_FS_NAMES - the file system names on the server that are used
                     by this run of LADDIS.  These will be newfsed.

    Also, of major importance, 

      SUTNAME - Node name of the server from the perspective of the
                prime client.  If null or equal to `hostname`, assumes
		local system.

    Required variables  that will default to my values  

      ROOTUSER={$ROOTUSER:-"root"}
      HOSTNAME_CMD=${HOSTNAME_CMD:-"hostname"} # location of
        command that returns hostname.
      NEWFS_CMD=${NEWFS_CMD:-"/etc/newfs"} # newfs command location
      MOUNT_CMD=${MOUNT_CMD:-"/etc/mount"} # Mount command location 
      UMOUNT_CMD=${UMOUNT_CMD:-"/etc/umount"} # Unmount command location
      MOUNTLIST_CMD=${MOUNTLIST_CMD:-"$MOUNT_CMD"} # command that will
      
      RSH=${RSH:-"remsh"} # remote shell to use

        list mounted filesystems.

      FSTAB=${FSTAB:-"/etc/checklist"} # location of the disk/FS mapping
      table.

      SLEEPTIME=${SLEEPTIME:-1} # time, in seconds to delay between n
        starting each newfa. Recommend at least 1 second.


    Optional variables that may be useful

      NEWFS_PARMS=${NEWFS_PARMS:-"-v"}  # paramters that $NEWFS_CMD that
       might be required. These come before raw device and disktype.
      NEWFS_POSTPARMS=${NEWFS_POSTPARMS}# as above expect after.

Process

Given the above variables appropriately passed, newfsall will then
perform two passes using this information.  The first pass checks a
number of conditions to help make sure that this is the correct file
system and to obtain the information required for newfsing and mounting.

  Pass One Activities
  1) Makes sure that no other files then '.', '..', 'lost+found' and 
     'CL[0-9]*' exist in the uppermost directory in the FS.  This should
     help avoid newfsing the wrong FS.
  2) Checks to make sure it's mounted.  [The program doesn't want to
  deal with various issues if it is not]'
  3) Obtains mount point from $FSTAB.  This will fail if an entry is not
     found.
  4) Checks to make sure that the calculated raw device exists [ Code
  make need extensions here].

The failure of any of the above will cause the script to terminate.

Pass two actually performs the newfses in parallel.  This can be controlled 
to some extent by using $SLEEPTIME.  $SLEEPTIME is the stagger factor
for each newfs.  A stagger factor of at least 1 is suggested.
If a failure in either the mount, newfs, umount or files test is
detected, the results will be saved and displayed at the end of the run.

Problems to spuhler@cup.hp.com
-Tom Spuhler -  Hewlett Packard - (408) 447-0143