Wednesday, April 14, 2010

Oracle VM

I had the opportunity earlier to understand something about OracleVM(OVM) by the Oracle representative that came to visit my company earlier today. Besides the Oracle Cloud-G Architecture that they presented, I am more curious about what is OVM


OVM or oracle virtual machines is based on open-sourced Xen Hypervisor technology. Oracle VM previously only supported on  linux and window platform or they sometime called the, linux and window guests. However, they have recently release Oracle VM server for SPARC or previously in Sun called LDOM.

Each OVM has its own virtual CPUs, network interfaces, storage and operating system. With Oracle VM, users have an easy-to-use browser-based tool for creating, cloning, sharing, configuring, booting and migrating VMs. Using Oracle EM, we can also administered the OVMs.

Oracle has always encourage better use of hardware. So it is not surprise that OVM is built upon predecessor like the Oracle Grid, ASM and RAC. OVM also serve as a building block in Oracle Clouds's offerings.

Installing OVM should be relatively straightforward like installing linux. Give it  a try and it's free.

Links to OVM specs:
http://www.oracle.com/us/technologies/virtualization/024974.htm

Below are some useful OVM commands

Logs path = /var/log/xen/xend 

List which virtual machines are running right now. 
# xm list

Start the vm.
 
# xm create vm.cfg

Kill the power to vm: vm01 - hard shutdown
 
# xm destroy vm01

Monitors a host and its domains in real time
 
# xm top 
 
Send the vm: vm01 the shutdown command, like doing a shutdown inside the vm
 # xm shutdown vm01
 
Current status of the guest operating system is written to disk and removed from system memory
 # xm suspend vm01
 
restore vm01 (any time including after a host system reboot) 
# xm resume vm01

Split / Join files

Sometime the files are too big to put on FAT32 thumbdrives. Use the split and cat commands here:

Split the file system.img into 3Gig chunks
 
# split --bytes=3000m system.img

Join up the files system.img.part1, system.img.part2, etc... into the file system.img
 
# cat system.img.part* > system.img


Here we created a new device, /dev/xvdb. Now we start up the vm and run fdisk

# fdisk /dev/xvdb

Create a physical volume from this device
 
# pvcreate /dev/xvdb1

Create the logical volume group from the physical device
 
# vgcreate lvm-oracledb /dev/xvdb1

Create the logical volume using 100% of the free space in the logical group lvm-oracledb
 
# lvcreate -l 100%FREE lvm-oracledb -n lvm0

Format the file system
 
# mkfs -t ext3 /dev/lvm-oracledb/lvm0

Create a mount point
 
# mkdir /oracledb

Add the following to "/etc/fstab" to automatically mount the volume when the computer starts up
/dev/lvm-oracledb/lvm0 /oracledb ext3 defaults 1 2
Mount the volume
 
# mount -a


ADDITIONAL LINK : 
http://www.techotopia.com/index.php/Managing_Xen_using_the_xm_Command-line_Tool

Remove a Disk (LVM)

Remove /etc/fstab entry[root@vl-ucm1 ~]# vi /etc/fstab

Unmount the device, get device name with:
lvdisplay
# umount /dev/lvm-stellent/lvm0

OR

[root@vl-ucm1 /]# ls /u01
downloads lost+found oracle
[root@vl-ucm1 /]# umount /u01
[root@vl-ucm1 /]# ls /u01


If you get:
[root@vl-ucm1 /]# umount /dev/lvm-stellent/lvm0
umount: /u01: device is busy


Find out what is using the device with:
[root@vl-ucm1 /]# fuser -m /dev/lvm-stellent/lvm0
/dev/lvm-stellent/lvm0: 3557m 3620m 3621m 3622m 3623m 3624m 3625m 3626m 3627m
[root@vl-ucm1 /]# ps auxw| grep 3557
root 3557 0.0 0.5 10856 3104 ? Ss 10:55 0:00 /usr/sbin/httpd

[root@vl-ucm1 /]# service httpd stop
Stopping httpd: [ OK ]
[root@vl-ucm1 /]# umount /dev/lvm-stellent/lvm0
[root@vl-ucm1 /]# df -h

And you should no longer see the disk with 'df'

Remove any entries from /etc/httpd/conf/httpd.conf that refer to this disk.

use lvremove to remove the logical volume
[root@vl-ucm1 /]# lvremove /dev/lvm-stellent/lvm0
Do you really want to remove active logical volume "lvm0"? [y/n]: y
Logical volume "lvm0" successfully removed


use lgdisplay and lgremove to remove logical group
[root@vl-ucm1 /]# vgremove lvm-stellent
Volume group "lvm-stellent" successfully removed


use pvdisplay and pvremove to remove physical volume
[root@vl-ucm1 /]# pvremove /dev/hdb1
Labels on physical volume "/dev/hdb1" successfully wiped


remove partition with fdisk /dev/hdb, 'd', enter, 'w' = write partition and exit
# fdisk /dev/hdb

Remove the disk entry from the vm.cfg file, and restart the vm.

To shrink a LVM

Just create a new disk, copy over contents and delete old volume.
.

No comments:

Post a Comment