From:	CSBVAX::MRGATE!@KL.SRI.Com:KARCHER%MIT.MFENET@nmfecc.arpa@SMTP 25-JUN-1987 06:07
To:	EVERHART
Subj:	Mounting Cluster disks

Received: from nmfecc.arpa by KL.SRI.COM with TCP; Tue 23 Jun 87 23:02:54-PDT
Received: from mit.mfenet by ccx.mfenet with Tell via MfeNet ;
	Tue, 23 Jun 87 19:48:42 PDT
Date:	Tue, 23 Jun 87 19:48:42 PDT
From:     KARCHER%MIT.MFENET@nmfecc.arpa
Message-Id: <870623194843.03l@nmfecc.arpa>
To:       INFO-VAX@KL.SRI.COM.ARPA
Comment: From KARCHER@MIT.MFENET on 23-JUN-1987 21:00:33.17 EDT
Subject: Mounting Cluster disks

In response to mounting cluster disks:

We use the following procedure to mount cluster disks at system startup (on each
node) without knowing the volume label. It depends on the fact that mount will
tell you the volume label in it's error message if the wrong one is specified.
The resulting error message is then parsed for the correct label. The method may
sound questionable but it's never failed yet. 

-------------- Cut here [62 lines follow] ---------------------------------
$! FILE: MOUNT.COM      VERSION 2.0     EDIT 860813 - CAK
$! DCL procedure to mount all disks that can be found without knowing the
$! volume labels. The disk is mounted once with a wrong label and the error
$! message analyzed to determine the correct label. A second mount is then
$! done with the label found in the error message. After a successful mount,
$! a logical name identical to the volume label is defined.
$!
$!  P1 - Optional parameter for SHOW DEVICE (DU,DR,DB etc, defaults to D).
$
$ DC$_DISK = 1                                  ! Symbol for disk class device
$ TELL := WRITE SYS$OUTPUT
$ IF "''NODE'" .EQS. "" THEN NODE := 'F$GETSYI("SCSNODE")'
$ TELL "Attempting to mount public disks for startup of system ''NODE' ..."
$
$ IF P1 .EQS. "" THEN P1 = "D"                  ! Default to all disks
$ ON ERROR THEN GOTO EOF
$ SHOW DEVICE/OUT=SHOWDEV.DAT 'P1'              ! Show all disk devices
$ OPEN FILE SHOWDEV.DAT                         ! Open the display file
$
$! Main loop to read device names from SHOW DEVICE output and find volume labels.
$! Note that there is no way an HSC disk can be mounted without knowing
$! the volume lable.
$
$NEXT_RECORD:
$ LABEL = "WRONG"                               ! Use wrong label to force error
$ READ/END=EOF FILE RECORD                      ! Read line of SHOW DEV output
$ DEVICE = F$ELEMENT (0,":",RECORD)
$ IF DEVICE .EQS. "" -
        .OR. F$LEN(DEVICE) .EQ. F$LEN(RECORD) -
        THEN GOTO NEXT_RECORD
$ IF .NOT.F$GETDVI (DEVICE,"EXISTS") THEN EXIT %X908    ! Real device?
$ ON ERROR THEN GOTO FIND_LABEL                         ! Trap errors from Mount
$ DEFINE/USER SYS$OUTPUT NL:                            ! Prevent bitching
$ DEFINE/USER SYS$ERROR MOUNTERR.DAT                    ! Save Mount errors in a file
$MOUNT:
$ IF F$GETDVI (DEVICE,"DEVCLASS") .EQ. DC$_DISK -       ! Insure its a disk
 .AND. F$GETDVI (DEVICE,"TRANSCNT") .EQ. 0 -            ! with no open files
 THEN MOUNT/NOASSIST/SYSTEM/NOREBUILD 'DEVICE' 'LABEL' 'LABEL'  ! Mount the disk shared
$ GOTO NEXT_RECORD
$ 
$! Entry point to analize error messages from MOUNT in an attempt to find
$! the correct volume label. 
$
$FIND_LABEL:                    ! Here to find label in mount's error message
$ ON ERROR THEN GOTO NEXT_RECORD                        ! Skip on next error
$ OPEN ERROR_FILE MOUNTERR.DAT                          ! Open error file
$NEXT_ERROR:
$ READ/END=END_ERROR ERROR_FILE RECORD                  ! Read an error line
$ IF F$EXTR (1,25,RECORD) .EQS. "MOUNT-I-VOLIDENT, label =" -
        THEN LABEL = F$ELEMENT (1,"'",RECORD)
$ GOTO NEXT_ERROR
$
$END_ERROR:
$ CLOSE ERROR_FILE
$ IF F$SEARCH ("MOUNTERR.DAT") .NES. "" THEN DELETE MOUNTERR.DAT;*
$ TELL "Found volume label for disk ''DEVICE' to be ''LABEL'"
$ IF LABEL .NES. "WRONG" THEN GOTO MOUNT        ! Try Mount again if label ok
$ TELL "%MOUNT-E-NOLABEL, Can't find volume label for device ''DEVICE'"
$ GOTO NEXT_RECORD                              ! Skip mounting this device
$
$EOF:
$ CLOSE FILE
$ IF F$SEARCH ("SHOWDEV.DAT") .NES. "" THEN DELETE SHOWDEV.DAT;*
---------------------------------- End of MOUNT.COM -----------------------

C. A. Karcher
MIT Plasma Fusion Center

KARCHER%PFCVAX@MIT-XX.LCS.MIT.EDU.ARPA
KARCHER%MIT.MFENET@NMFECC.ARPA
KARCHER%MIT.MFENET@ANLVMS.BITNET
