A place for Unix Thoughts and Ideas

Monthly Archives: February 2011

Uberjs on Solaris 10

For maintenance of my Solaris 10 images I have gone with the simple approach of maintaining one profile that works for all versions and architectures.

It is simply a profile that starts with SUNWCXall and then removes and adds packages back in and has worked consistently for various Solaris versions since u5. When a new update comes out, I just update the profile for packages to add/remove and re-check.

This is in contrast to having to generate and manage flars for every hardware type and os revision.

Since my provisioning strategy depends on Jumpstart profiles and not Flars, I have had a solid dependency on RARP/DHCP/PXE for provisioning.

I have no control over the DHCP/PXE on my subnets, so I updated Uberjs to work on Solaris 10 so I can provision x86 and Sparc systems when I didn’t have a local jumpstart server.

I post my process for building the jumpstart cd’s for Solaris 10 sparc and x86

HP-UX Disk Device Name Tricks and Info Gathering

Coming from the Solaris world, the old style disk naming convention used in HP-UX v1 and v2 can be confusing.

Here are some quick commands to assist in the task of matching devices to LUN numbers, and general information gathering in HP-UX

Show Volume groups and disks
for i in `vgdisplay 2>1 | grep “VG Name” | awk ‘{print $3}’ | grep -v ‘^vg’ | cut -d/ -f3`; do
printf “Group $i\n”
vgdisplay -v $i | egrep “PV Name|Free PE”

Group vg00
Free PE 2665
PV Name /dev/dsk/c0t6d0s2
Free PE 2665
Group vg10
Free PE 1640
PV Name /dev/dsk/c2t1d7
PV Name /dev/dsk/c5t1d7 Alternate Link
Free PE 0
PV Name /dev/dsk/c2t2d0
PV Name /dev/dsk/c5t2d0 Alternate Link
Free PE 41
PV Name /dev/dsk/c2t2d1
PV Name /dev/dsk/c5t2d1 Alternate Link
Free PE 1599

List Volume Groups
vgdisplay 2>1 | grep “VG Name” | awk ‘{print $3}’ | grep -v ‘^vg’ | cut -d/ -f3

List Fibre adapter paths
ioscan -kfC fc | awk ‘{ print $3}’ | egrep -v ‘H\/W|^$’

Read more of this post

Adding multiple service accounts users in loop form

Here is nifty example of using multiple fields in a for loop.

As part of the build process for some of my systems, I need to add multiple accounts at the same time.

I could write this out every time, but this stub makes it easy and it can be reused when I get requests in the future.

for users in \
“u=oradev6 i=6048 ga=oinstall g=dba proj=group.dba”\
“u=oradev7 i=6049 ga=oinstall g=dba proj=group.dba”;
eval $users
useradd -u $i -g $g -G $ga -d /export/home/$u -s /bin/bash -c “$u User” -m $u
passwd -N $u

usermod -K project=$proj $u

echo $u >> /etc/cron.d/cron.allow

Live Upgrade BE Creation time

When working with Live Upgrade on ZFS, you can accumulate a lot of boot environments over time.

Here is a little trick for showing the creation time of your different boot environments

for i in `lustatus | egrep ‘yes|no’ | awk ‘{print $1}’ `; do lufslist $i | egrep ‘ / ‘ | awk ‘{print $1}’ | xargs -I {} zfs get creation {}; done | egrep -v ‘NAME *PROPERTY’ | sed -e ‘s/creation//’

root@testserver-03 # for i in `lustatus | egrep ‘yes|no’ | awk ‘{print $1}’ `; do lufslist $i | egrep ‘ / ‘ | awk ‘{print $1}’ | xargs -I {} zfs get creation {}; done | egrep -v ‘NAME *PROPERTY’ | sed -e ‘s/creation//’
rpool/ROOT/solaris10_1 Mon Jan 24 15:22 2011 –
rpool/ROOT/sol10_upgrade Tue Jan 25 9:35 2011 –
rpool/ROOT/before_sc33 Tue Jan 25 10:59 2011 –
rpool/ROOT/test Wed Feb 2 14:11 2011 –

You can get similar information on Solaris 11 with beadm

admin@sol11test:~# beadm list -d
BE/Dataset Active Mountpoint Space Policy Created
———- —— ———- —– —— ——-
rpool/ROOT/baseInstall – – 98.0K static 2010-12-10 11:39
rpool/ROOT/solaris NR / 2.13G static 2010-12-10 11:09
rpool/ROOT/test – – 55.0K static 2011-02-02 14:17