OracleVM: playing with templates

Today I decided to take some time and play with one of the OracleVM Templates that is available on otn.oracle.com. The template that I started playing with is the HVM Small x86 template. This template is an OREL4 version of the kernel that fits on a 4G partition.

1) download the template and put it in the /OVS/seed_pool/OVM_EL4U5_X86_HVM_4GB directory. There should be three files; System.img, vm.cfg, vm.cfg.orig

2) import this template on the vmmaster by going down the Resources -> Virtual Machine Templates -> Import option. You want to create a template from this directory so that we can create a virtual machine. You start with an internal vm template creation, select the vmserver, the OVM_EL4U5_X86_HVM_4GB images, OREL4 as the OS, create a name (HVM4G was my choice), a password, and a description of the image.

Note** I ran out of disk space on my vmserver installation and did add a USB disk to the vmserver. I mounted this server as /usb/2 and put the template file on the usb disk. I then created a symbolic link to the usb disk to free up the root disk. This was done with
# cd /OVS/seed_pool
# ln -s /usb/2/seed_pool/OVM_EL4U5_X86_HVM_4GB .

When you create the template it will show that the template file is only 1 block in size. This is misleading but it does work. The only restriction is that I needed to create an automount in the /etc/fstab on the vmserver to automount the usb disk when it boots up.

3) create a virtual machine based on this template. It creates a file that is 6.4G in size in the /OVS/running_pool/???_HVM4G directory. This file is the basis for the template installation.  At this point you are ready to run the virtual image with a 4G root partition. The passwords are located in the readme file on the  http://download.oracle.com/otn_software/virtualization/ site.

4) after running the virtual machine, I wanted to change a few things. Some things by default did not come up so the following is a list of customizations that I made to make the system a little more friendly.

a) login as root and vi /etc/sudoers. I copy the root definition to be an oracle definition. This allows me to login as oracle and sudo commands as if I were root. The default is to let oracle run any root commands but it does log what is done so I can figure out later what needed to happen.
b) I edited the /etc/inittab and changed the line
id:3:initdefault:
to
id:5:initdefault:
This brings you into the X11 windowing system instead of the command line. I personally find that the Oracle installer works much better with a window install than with a command line install.
c) create a shared virtual disk on the vmserver using the vmmaster console. I created a 20G shared disk. This is created in the /OVS/shared_pool directory. I called the share Distribution which created a 20G Distribution.img file. This gives me a little more disk space to work with ontop of the 4G disk space. The 4G space is adequate but difficult if I have to download the install images and install the software on the same disk. The operating system by default consumes about 2G of the disk leaving only 2G free to play with.
d) download firefox. I really don’t work well with Konqurer. It isn’t bad but it isn’t what I am use to running. I downloaded the tar image into /home/oracle. I wanted to move it to the shared disk but I didn’t have it configured properly at this point
e) go into the vmmaster manager screen and mount the shared virtual disk. This is done by going into the virtual machine tab and clicking on the virtual machine name. In our case it was HVM4G. This opens up a screen that shows the General Information, Network, Virtual Disk, and Monitor. Click on the Virtual Disk tab and add a virtual disk.
Note** adding the disk does not add it to a live system. The act of adding the disk only changes the vm.cfg file. If you reboot the operating system from a command shell or xterm, the virtual disk will never be found. You will need to halt the operating system, shutdown the virtual machine, start the virtual machine, and look for the disk. The device name will be mapped in the vm.cfg file. In my instance it was mapped to the /dev/hdd device. Once I rebooted the guest operating system I was able to execute the following commands to make the disk usable.
# /sbin/fdisk /dev/hdd
n (as in new partition)
p ( as in primary partition)
1 (as in partition 1)
accept the start and stop defaults which will allocate the entire disk
w (as in write the new partition information and exit)
# mkfs -t ext3 /dev/hdd1
# mkdir /shared
# mount /dev/hdd1 /shared
# vi /etc/fstab – add the mount to make it permenant
f) launch firefox and change the proxy setting to work within the corp firewall. Once I did this I was able to start downloading software to install.

Some things to note. The HVM4G defaults to dhcp configuration for the network. This typically isn’t a problem but the database usually likes to come up on the same ip address. This is on my list of things to do.  I also want to save this updated and modified installation as a new template so that I don’t need to redo everything over again. This consumes a little disk but since most of the large stuff is stored on the shared virtual disk it isn’t an issue. I also need to test and see if I can mount the shared disk between multiple operating systems using the ext3 file system or does this restrict me to one mount at a time. I think that it does restrict me and I might need to create the file system as a clustered file system. I will also need to make sure that the ocfs software is installed on the operating system as well.

Using this template does reduce the time needed to get up and running. The template reduces the Linux install and patch time as well as the configuration time needed to get a database up and running. Once I get my personal tweaks finished, I can create my own default Linux template and start from there. Overall, I am relatively happy with this process.