September 17, 2013

Having fun with Oracle's Solaris 11.1 Automated Installer

I thought I'd provide a complete script that will derive a manifest. This one will create a swap that is the size of the memory of the machine and create a mirrored root with a spare disk:

#!/bin/ksh93 -vx
# Create a mirrored root pool plus a spare disk in the pool for all the disks on the machine
# (apart from the annoying USB disk)
# Mount some filesystems

cat <<HERE >${MFST}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE auto_install SYSTEM "file:///usr/share/install/ai.dtd.1">
<ai_instance name="orig_default" auto_reboot="false">
<software type="IPS">
<!-- Specify locales to install -->
<facet set="false">facet.locale.*</facet>
<facet set="true">facet.locale.en</facet>
<facet set="true">facet.locale.en_GB</facet>
<publisher name="solaris">
<origin name="http://servername/solaris"/>
By default the latest build available, in the specified IPS
repository, is installed. If another build is required, the
build number has to be appended to the 'entire' package in the
following form:

<software_data action="install">


function handler

trap handler ERR

/usr/bin/aimanifest load ${MFST}

donotuse=1 # don't want to pick up built in usb disk
set -A filesystem_name_arr export export/home zones
set -A mountpoint_arr \/export \/export\/home \/zones
let G=${K}*${K}*${K}
let mem_size=${SI_MEMSIZE}/${G}

/usr/bin/aimanifest add -r target/logical@nodump false
/usr/bin/aimanifest set target/logical@noswap false

/usr/bin/aimanifest add -r target/logical/zpool@name rpool
/usr/bin/aimanifest set target/logical/zpool[@name=rpool]@is_root true

vdev=$(/usr/bin/aimanifest add -r target/logical/zpool[@name=rpool]/vdev@name rpool_vdev)
/usr/bin/aimanifest set ${vdev}@redundancy mirror

zvol=$(/usr/bin/aimanifest add -r target/logical/zpool[@name=rpool]/zvol@name swap)
/usr/bin/aimanifest set ${zvol}@action create
/usr/bin/aimanifest set ${zvol}@use swap
/usr/bin/aimanifest add ${zvol}/size@val ${mem_size}gb

vdev=$(/usr/bin/aimanifest add -r target/logical/zpool[@name=rpool]/vdev@name rpool_vdev_spare)
/usr/bin/aimanifest set ${vdev}@redundancy spare

for ((j=0;j<=$no_filesystems;j++)) ; do
filesys=$(/usr/bin/aimanifest add -r target/logical/zpool[@name=rpool]/filesystem@name ${filesystem_name_arr[$j]})
/usr/bin/aimanifest set ${filesys}@mountpoint ${mountpoint_arr[$j]}

/usr/bin/aimanifest add -r target/logical/zpool[@name=rpool]/be@name solaris


for ((i=1;i<=$SI_NUMDISKS-$donotuse;i++)) ; do

# doesn't work as described in the oracle notes, but this does
eval temp_disk="$"SI_DISKNAME_${i}
eval curr_disk=$temp_disk

if [[ $i -eq $SI_NUMDISKS-$donotuse ]]; then

disk=$(/usr/bin/aimanifest add -r target/disk@in_vdev ${vdev_name})
/usr/bin/aimanifest set ${disk}@whole_disk true
/usr/bin/aimanifest set ${disk}@in_zpool rpool

disk_name=$(/usr/bin/aimanifest add -r ${disk}/disk_name@name ${curr_disk})
/usr/bin/aimanifest set ${disk_name}@name_type ctd



- No comments Not publicly viewable

Add a comment

You are not allowed to comment on this entry as it has restricted commenting permissions.

September 2013

Mo Tu We Th Fr Sa Su
|  Today  | Oct
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

Search this blog



Most recent comments

  • hello. i am from poland. i uwielbiam was! by on this entry
  • Hello, It was more for internal consumption, I will check it over and send you a version, can you em… by Maria MacCallum on this entry
  • Hello Maria, i don't see the script setup–, can you post it ? I'am looking too for an example… by FRANCISCO on this entry
  • Solaris 11.2 returns the value of SI_MEMSIZE in Mb's now by Maria MacCallum on this entry

Blog archive

Not signed in
Sign in

Powered by BlogBuilder