Monday, November 22, 2010

Solaris Ldom's

I received a loaner Sparc T5240 box from oracle the other day to test out their ldom's. Here are some basic commands I used to create a guest. Note, I didn't go into how to install Solaris inside the ldom.

I installed version 1.3 of the Ldom software which I downloaded directly from Oracle. ( LDoms_Manager-1_3.zip )
The software has an installer that sets up many of the things you need.

One thing I found after looking around was that the networking inside a guest couldn't talk to the outside world.
I adjusted the networking including plumbing the virtual switch and giving it the same MAC as the underlying nxge4 ( 10G ) interface.

ifconfig nxge0 down
ifconfig nxge0 unplumb
ifconfig vsw0 plumb
ifconfig vsw0 X.X.X.X netmask 255.255.255.0
ifconfig vsw0 up
mv /etc/hostname.nxge4 /etc/hostname.vsw0
ldm remove-vswitch primary-vsw0
ldm add-vsw mac-addr=0:14:4f:c1:c2:c8 net-dev=nxge4 primary-vsw0 primary

Now on to the guest:

First I created two zfs zvols. One for the OS and one for a zpool.

zfs create -V 12000m pool0/vdomains/ldom2
zfs create -V 100g pool0/vdomains/zpool-ldom2

To install solaris inside the guest I am going to use the 10u9 iso image and have it in /tmp/iso/sol-10-u9-ga-sparc-dvd.iso

I gave it 4G of RAM and 1 virtual CPU:

ldm add-domain ldom2
ldm stop test1
ldm add-vcpu 1 ldom2
ldm add-memory 4096m ldom2
ldm add-vnet vnet1 primary-vsw0 ldom2
ldm add-vdsdev /dev/zvol/dsk/pool0/vdomains/ldom2 zdisk2@primary-vds0
ldm add-vdisk zdisk2 zdisk2@primary-vds0 ldom2
ldm add-vdsdev /dev/zvol/dsk/pool0/vdomains/zpool-ldom2 zdisk3@primary-vds0
ldm add-vdisk zdisk3 zdisk3@primary-vds0 ldom2
ldm add-vdsdev /tmp/iso/sol-10-u9-ga-sparc-dvd.iso iso_vol@primary-vds0
ldm-vdisk vdisk vdisk_iso iso_vol@primary-vds0 ldom2
ldm bind-domain ldom2
ldm set-variable autoboot\?=false ldom2
ldm start ldom2

Now I can telnet to port 5000 on the localhost and I'll will be on the console but the machine will be at the OK> prompt.

Type: show-disks to find the ISO, or CDROM link and then type boot and the long path to boot off the ISO.

I did a typical Solaris install for the guest and actually used a flar.

Once the install was done I created a zpool on the second disk and I had a fully working solaris guest with zfs inside.

To get the guest to book automatically and not stop at the OK> prompt each time I changed the autoboot to true from false.

Thursday, October 14, 2010

Look at the latest patch number in solaris

Here is a quick way to print out just the latest patch versions on a solaris box:
showrev -p | perl -lane '($p,$rev) = ($F[1] =~ /(\d+)-(\d+)/); $has{$p}=$rev if $has{$p}<$rev; END { map { print "$_-$has{$_}" } sort keys %has }'

Friday, August 27, 2010

Deleting all the blastwave packages on a Solaris node

I needed to delete all of the Blastwave packages on a Solaris node to clean it up and I didn't want to do them one at a time or keep hitting yes.

Here is a quick way that I found:
>> yes | pkgrm $(pkinfo | awk '/CSW/ { print $2}')

Friday, February 5, 2010

ludelete problem in Live Upgrade

I needed to delete a live upgrade environment to get ready to make a new one for 10u8.
Running the ludelete command gave me this error:
>>ludelete 10u6_disk2
System has findroot enabled GRUB
Checking if last BE on any disk...

ERROR: Last BE on disk
ERROR: This boot environment <10u6_disk2> is the last BE on the above disk.
ERROR: Deleting this BE may make it impossible to boot from this disk.
ERROR: However you may still boot solaris if you have BE(s) on other disks.
ERROR: You *may* have to change boot-device order in the BIOS to accomplish this.
ERROR: If you still want to delete this BE <10u6_disk2>, please use the force option (-f).
Unable to delete boot environment.

So I tried it with the -f option after I checked to make sure that /dev/dsk/c3t0d0 was in fact the correct disk ( booting off /dev/dsk/c3t4d0 ).

The next problem I ran in to was that it couldn't mount some zfs filesystems that it thought should be there but didn't exist anymore.

>>ludelete -f 10u6_disk2
System has findroot enabled GRUB
No entry for BE <10u6_disk2> in GRUB menu
ERROR: mount: /storage/pool0/blah: No such file or directory
ERROR: cannot mount mount point device
ERROR: failed to mount file system on
ERROR: unmounting partially mounted boot environment file systems
ERROR: cannot mount boot environment by icf file
ERROR: Cannot mount BE <10u6_disk2>.
Unable to delete boot environment.

I manually edited /etc/lu/ICF.1 and cleared out all of the zfs mounts and re-ran ludelete which returned even though it was still upset about a few mounts.

>>ludelete -f 10u6_disk2
System has findroot enabled GRUB
No entry for BE <10u6_disk2> in GRUB menu
Determining the devices to be marked free.
ERROR: cannot open 'pool0/blah2/sendsrc': dataset does not exist
ERROR: cannot mount mount point device
ERROR: failed to mount file system on
ERROR: unmounting partially mounted boot environment file systems
ERROR: cannot mount boot environment by icf file
WARNING: Unable to mount ABE <10u6_disk2>: cannot complete lumk_iconf
WARNING: Unable to determine disk partition configuration information for BE <10u6_disk2>.
WARNING: Unable to determine the devices/datasets to be freed for BE <10u6_disk2>.
Updating boot environment configuration database.
Updating boot environment description database on all BEs.
Updating all boot environment configuration databases.
Boot environment <10u6_disk2> deleted.

And to check the status and make sure it is gone:

>>lustatus
Boot Environment Is Active Active Can Copy
Name Complete Now On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
10u6 yes yes yes no -









Thursday, February 4, 2010

Solaris PCA patch utility

I needed to patch one of our solaris nodes before taking a flar of it so I pulled out the trusty PCA tool.
When I ran it, with my Sunsolve account username/password, I received a 401 unauthorized error for each patch.
I have an active Sunsolve account linked to our contracts, and I can sign into the web page with no problems, so I didn't understand why it wasn't working.
I then logged into the Sunsolve account, searched for the list of patches that pca -l gave me, and built up their download script.
When I ran it I received the same error, unauthorized.
I took the exact link that the download script was using for one patch and put it in my browser. A page to accept the license agreement came up and after I accepted the license everything started working again.
I sure hope this isn't a foreshadow into what things will be like with "Oracle".

Thursday, January 21, 2010

Bash History

A quick way to add a date/time stamp to your bash history:
export HISTTIMEFORMAT="::%h/%d - %H:%M:%S:: "

You can put it in your favorite bash start up file like .bash_profile or .bashrc

Thursday, January 14, 2010

How to convert a mac from Cisco/Foundry format to Unix format

I needed to associate servers to ports on our switches but the formats are different so I needed a way to convert them.

Here is a quick perl one line to go from Cisco/Foundry to Unix:
perl -ane '$_=~s/(..)\.?/\1:/g;$_=~s/:$//g; print $_'

An example:
echo 0019.b9f5.93f3 | perl -ane '$_=~s/(..)\.?/\1:/g;$_=~s/:$//g; print $_'
00:19:b9:f5:93:f3