JET server using Nevada and iso images

Things have been slightly problematic on the JET server running on Nevada front mainly due to 2 issues.

  1. There is/was a bug in cpio (See BugID 6686818) which meant that setup_install_server didn't copy the media correctly.
  2. setup_install_server on earlier Solaris releases didn't understand zfs, therefore it was difficult to copy onto a zfs filesystem.

Why not just use iso images?

Why not indeed? I'm in the habit fo simply downloading and keeping the .iso images for all releases, and I used to then "expand" it by lofimounting and then running setup_install_server. I realised I really didn't need to do that, I could just use the lofi mounted image, and get away from having to ever run setup_install_server, and not need to use up double the space per O/S image I wanted to keep.

 So.. what was missing?

I needed a way to lofiadm, mount and nfs share the Solaris media. Also because x86 builds also lofi mount the boot directory and mount it into the /tftpboot directory, I'd also need to lofimount a lofimounted filesystem as well.

Firstly I did everything manually to ensure that everything works fine, then I wrote a script, which reads a config file (which lives in /opt/SUNWjet/etc).

Inline here:

#!/usr/bin/ksh -p
#
# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
################################################################################

# sanitize PATH, and ensure required components are in front
PATH=/sbin:/usr/sbin:/bin:/usr/bin:${PATH}
export PATH

BINDIR="`cd ${0%/\*}; pwd`"
ETCDIR="`cd ${BINDIR}/../etc; pwd`"

PATH=${BINDIR}:${PATH}
export PATH

MEDIALOC=${ETCDIR}/solaris_iso_locations

if [ "$#" != "0" ]; then
	echo "Usage: $0"
	echo " "
	exit 1
fi

#
# Check to see if the media locations file exists.
#

for iso in `cat ${MEDIALOC} | grep -v "\^#" | awk '{print $1}'`
do
	lofiname="`lofiadm | awk '$2 == iso {print $1;}' iso=$iso`"
	if [ -z  "${lofiname}" ]; then
		lofiname="`lofiadm -a $iso`"
		echo "Added $iso as lofi filesystem: $lofiname"
	fi
	mp="`cat ${MEDIALOC} | awk '$1 == iso {print $2;}' iso=$iso`"
	mounted="`df -k | awk '$1 == lofiname && $6 == mp {print $6;}' lofiname=
$lofiname mp=$mp`"
	if [ -z "${mounted}" ]; then
		mount -F hsfs $lofiname $mp
		mounted=$mp
		echo "Mounted $lofiname at $mp"
	fi
 	shared="`share | awk '$2 == mp {print $2;}' mp=$mp`"
	if [ -z "${shared}" ]; then
		share -o ro,anon=0 $mounted
		echo "Shared $mounted"
	fi
	# Deal with lofi mount in x86
	mountboot="`cat /etc/vfstab | awk '$1 == mpboot {print $3;}' mpboot=\\"$m
p/boot\\"`"
	if [ -n "${mountboot}" ]; then
	bootmounted="`df -k | awk '$1 == mpboot {print $6;}' mpboot=\\"$mp/boot\\"
`"
		if [ -z "${bootmounted}" ]; then
			mount $mountboot
			echo "Remounted $mountboot"
		fi
	fi
done

It parses the solaris_iso_locations file which looks like this (I've attached my filled out one)

# This file is used to specify the mountpoints for iso images. You need
# to create the mountpoint, update this file, and then run /opt/SUNWjet/bin/
# share_isos. This will lofimount all isos listed here. You will then
# need to run add_solaris_location for each image as normal.
# You should run the share_isos command everytime the JET server is
# rebooted.
/backup/Solimages/s10sparc_0508.iso    /export/install/iso/Solaris_10_0508s
/backup/Solimages/s10x86_0508.iso    /export/install/iso/Solaris_10_0508x
/backup/Solimages/solarisdvdb90x.iso    /export/install/iso/Solaris_11_b90x
/backup/Solimages/solarisdvdb90s.iso    /export/install/iso/Solaris_11_b90s

 

What it does.

In short, it reads the config file and mounts (if not already mounted) the iso images on the path specified. It will then NFS share the mountpoint, and parse the /etc/vfstab and do the /tftpboot lofi mounts if necessary. (NOTE: add_install_client creates those entries in /etc/vfstab the first time it is run for that O/S. You MUST edit the /etc/vfstab and change the mount_at_boot flag to "no", otherwise your booting your JET server will fail.)

Running share_isos produces the following:

# /opt/SUNWjet/bin/share_isos
Mounted /dev/lofi/2 at /export/install/iso/Solaris_10_0508s
Shared /export/install/iso/Solaris_10_0508s
Mounted /dev/lofi/3 at /export/install/iso/Solaris_10_0508x
Shared /export/install/iso/Solaris_10_0508x
Remounted /tftpboot/I86PC.Solaris_10-1
Mounted /dev/lofi/4 at /export/install/iso/Solaris_11_b90x
Shared /export/install/iso/Solaris_11_b90x
Remounted /tftpboot/I86PC.Solaris_11-6
Mounted /dev/lofi/5 at /export/install/iso/Solaris_11_b90s
Shared /export/install/iso/Solaris_11_b90s
# /opt/SUNWjet/bin/share_isos
# 

 Note: if you run share_isos again, it does nothing as everything is already mounted and shared, so its easy to re-run it whenever you want just to confirm it's all good. (I considered having JET call it automatically, but I'm not completely sure how I want to do that yet. Well thought out suggestions welcomed.)

The bottom line is that I can now easily use my laptop running Nevada and a ZFS filesystem and use it as a JET server for any version of Solaris without ever needing to run "setup_install_server". And the bonus is I've now got about 12GB of space back!!

tags:

Comments:

Post a Comment:
Comments are closed for this entry.
About

mramcha

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today