Main | February 2009 »

January 2009 Archives

January 9, 2009

Resizing the filesystem of your Oracle VM template

To be quick on some testing you download one of the handy Oracle VM templates.
But after using the template for a while you notice the root filesystem of the VM got full, what do you do ?
Since this question came along for a couple of times now, one way to handle this is described below.
First, find out what the current size of the root filesystem is:


[root@vsupp1 ~]# df -m
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
3844 2885 761 80% /
/dev/hda1 99 12 82 13% /boot
tmpfs 502 0 502 0% /dev/shm

So, we add a second 'disk' to the VM. In this case it is discovered as /dev/hdb. In order to use it, we put a partition on it with the label of LVM (logical volume manager):

[root@vsupp1 ~]# fdisk /dev/hdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

Disk /dev/hdb: 4194 MB, 4194304000 bytes
255 heads, 63 sectors/track, 509 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-509, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-509, default 509):
Using default value 509

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.


Now the partition is on it, we create a physical volume on top of it:

[root@vsupp1 ~]# pvcreate /dev/hdb1
Physical volume "/dev/hdb1" successfully created


Now, let's take a look the current volume groups we use:

[root@vsupp1 ~]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup00
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               5.88 GB
  PE Size               32.00 MB
  Total PE              188
  Alloc PE / Size       188 / 5.88 GB
  Free  PE / Size       0 / 0   
  VG UUID               o0hAPH-zDE1-dmlH-Ol3e-01yf-Y9fX-grxs1G

So, let's extend this volume group with the new physical volume:

[root@vsupp1 ~]#  vgextend VolGroup00 /dev/hdb1
  Volume group "VolGroup00" successfully extended

Let's find out if the VG size changed:


[root@vsupp1 ~]# vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 9.75 GB
PE Size 32.00 MB
Total PE 312
Alloc PE / Size 188 / 5.88 GB
Free PE / Size 124 / 3.88 GB
VG UUID o0hAPH-zDE1-dmlH-Ol3e-01yf-Y9fX-grxs1G

The VG size changed, now let's take a look at the Logical Volume (LV) size:

[root@vsupp1 ~]# lvdisplay
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol00
  VG Name                VolGroup00
  LV UUID                DAbIh5-2rnI-Scah-xhcI-BM9a-lGIL-drQQXl
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                3.88 GB
  Current LE             124
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:0
   
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol01
  VG Name                VolGroup00
  LV UUID                04Is4L-1miY-0t5W-3Fth-3EuT-eF5M-eE4DU4
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                2.00 GB
  Current LE             64
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:1

So the LV (VolGroup00/LogVol00) we use is 3.88 GB. Here is the resize:

   
[root@vsupp1 ~]# lvextend -L 7.6G /dev/VolGroup00/LogVol00
  Rounding up size to full physical extent 7.62 GB
  Extending logical volume LogVol00 to 7.62 GB
  Logical volume LogVol00 successfully resized

Cool, the LV is extended. Now the thing left to extend is the filesystem.
With Oracle Enterprise Linux we can do this online as we go:



[root@vsupp1 ~]# resize2fs /dev/VolGroup00/LogVol00 7G
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 1835008 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 1835008 blocks long.

And see, the filesystem is resized online.

[root@vsupp1 ~]# df -m
Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                          6944      2886      3700  44% /
/dev/hda1                   99        12        82  13% /boot
tmpfs                      502         0       502   0% /dev/shm

Rene Kundersma
Oracle Expert Services, The Netherlands

January 10, 2009

Running Oracle VM Server into an Oracle VM Server


Believe it or not, there can be a valid reason to run an Oracle VM Server into an Oracle VM Server and run a Virtual Machine into that. In search of a solution people asked if this was something they could do. They also realized "could do" != "advised to do"


One thing going through my mind immediately was, even if this would work, then this will probably only for education purposes etc. And that was exactly the goal...


Step 1. Logged on to a Dell Precision 3400, with a Quad core cpu and 8GB RAM. This should be enough to do the job. Then booted up Oracle VM Server 2.1.2. After that, started Oracle VM Manager in one of the domains and imported the Oracle VM Server as an iso image as a resource.



Step 2. Created a virtual machine with the following specs:
- Ram 3GB (planning to run only one guest into this guest.)
- Diskspace (enough to hold the Oracle VM Server only since I would run my iso's from the shared NFS storage)
- machine name: OVSServer



Step 3. After creating the VM, the installation of Oracle Virtual Server was as easy as in a normal situation. On my first Oracle VM Server this was now the status:


[root@ovms1 ~]# xm list
Name ID Mem VCPUs State Time(s)
Domain-0 0 667 4 r----- 1207.6
92_OVSServer 9 3000 1 r----- 2800.0
oel-repos 1 1400 2 -b---- 9.1
openfiler1 2 256 1 -b---- 72.2


As you can see the first Oracle VM Server was named: ovms1.


Step 4. Now that I have a Oracle VM Server running into an Oracle VM Server, half of the proof is done. A complete test would of course be to run a VM guest into that.
So, the /OVS was then mounted on the existing NFS share that hold the "running_pool" images, so we were able to use an existing para virtualized image I often use for RAC things.

[root@ovsvirt ~]# xm list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0   542     1     r-----    770.9
vdb11a                                       1  1400     1     ------   2584.5


As shown above, the second Oracle VM Server hostname is called ovsvirt.


Step 5. I noticed, that I could not use Hardware Virtualization Support. So until now I only tried to run para virtualized. Whit that information I was able to start the virtual guest "vdb11a" .

Step 6: See if I could get CRS running on that node:

[root@vdb11a bin]# /crs/bin//crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora....C21.srv application    ONLINE    ONLINE    vdb11a      
ora....C22.srv application    ONLINE    OFFLINE               
ora....NGC2.cs application    ONLINE    ONLINE    vdb11a      
ora....C21.srv application    ONLINE    ONLINE    vdb11a      
ora....C22.srv application    ONLINE    OFFLINE               
ora....INGX.cs application    ONLINE    ONLINE    vdb11a      
ora....21.inst application    ONLINE    ONLINE    vdb11a      
ora....22.inst application    ONLINE    OFFLINE               
ora....B1C2.db application    ONLINE    ONLINE    vdb11a      
ora....SM1.asm application    ONLINE    ONLINE    vdb11a      
ora....1A.lsnr application    ONLINE    ONLINE    vdb11a      
ora.vdb11a.gsd application    ONLINE    ONLINE    vdb11a      
ora.vdb11a.ons application    ONLINE    ONLINE    vdb11a      
ora.vdb11a.vip application    ONLINE    ONLINE    vdb11a      
ora....SM2.asm application    ONLINE    OFFLINE               
ora....1B.lsnr application    ONLINE    OFFLINE               
ora.vdb11b.gsd application    ONLINE    OFFLINE               
ora.vdb11b.ons application    ONLINE    OFFLINE               
ora.vdb11b.vip application    ONLINE    ONLINE    vdb11a 


Summary. Test succeeded.

We are able to run an oracle VM Server as a guest into an Oracle VM Server. And even into that Oracle VM Server, you could run Oracle RAC as a virtual guest (unsupported) without effort.


Rene Kundersma
Oracle Expert Services, The Netherlands

Adding a block device online to an Oracle VM


In a previous blog posting an example has been given how to resize the root filesystem of your Oracle VM template. In a comment on this blog someone asked how to add a block device to a running Oracle VM. This block device could then be used to put the filesystem on.
Here is the answer.



My Oracle VM Server indicates there are 4 guests running (without Dom0):


[root@ovms1 ]# xm list
Name ID Mem VCPUs State Time(s)
Domain-0 0 667 4 r----- 1905.1
oel-repos 1 1400 2 -b---- 62.1
openfiler1 2 256 1 -b---- 122.5
vdb11a 10 1400 1 -b---- 24.3
vsupp1 6 1500 2 -b---- 984.3


So, for the vdb11a we want to add a block device online. First we create a file which we will use as 'block device".


[root@ovms1 ]# dd if=/dev/zero of=extradisk01.img bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 0.194952 seconds, 538 MB/s


Then, we attach this file as a block to the VM with ID 10 (vdb11a):


[root@ovms1 ]# xm block-attach 10 file:`pwd`/extradisk01.img /dev/xvdc1 w


The 'w' indicates the disk is read/write available, but other options are available, this is the syntax:


xm block-attach domain-id be-dev fe-dev mode [bedomain-id]

Create a new virtual block device. This will trigger a hotplug event for the guest.
OPTIONS
domain-id The domain id of the guest domain that the device will be attached to.
be-dev The device in the backend domain (usually domain 0) to be exported.
This can be specified as a physical partition (phy:sda7) or as a file
mounted as loopback (file://path/to/loop.iso).
fe-dev How the device should be presented to the guest domain. It can be specified
as either a symbolic name, such as /dev/hdc, for common devices, or by
device id, such as 0x1400 (/dev/hdc device id in hex).
mode The access mode for the device from the guest domain.
Supported modes are w (read/write) or r (read-only).
w! will make the hypervisor think the vbd attached to multiple domains to be ok.
bedomain-id The back end domain hosting the device. This defaults to domain 0.





In the syslog of the VM guest you see the disk coming in:


Jan 10 20:52:58 vdb11a kernel: Registering block device major 202


Let's double check if this is our disk, it should be about 100M


[root@vdb11a ~]# fdisk -l /dev/xvdc1

Disk /dev/xvdc1: 104 MB, 104857600 bytes
255 heads, 63 sectors/track, 12 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/xvdc1 doesn't contain a valid partition table
[root@vdb11a ~]#



There is also an option to detach the block device
Please note also to add the file to the vm.cfg because if you forget, the next time you wonder where the device is.



Rene Kundersma
Oracle Expert Services, The Netherlands

January 20, 2009

Sharing your OVS OCFS2 dir on more then four nodes


For a real Oracle Grid environment with 7 Oracle Virtual Servers, today I had to configure a shared "/OVS" directory on OCFS2.


Oracle VM Server provides a great option to share the Oracle VM guest images on a shared location with a shared filesystem.


With that, you can do live migrations and/or make the guests available on other machines.
Also with a shared filesystem an Oracle VM can be made high available.


All went well, but after four nodes I received a message about the maximum number of slots being used.


Because of that I was not able to mount the filesystem on nodes 5,6 and 7.


In order to mount the shared filesystems, I had to:
- unmount the filesystem on all nodes
- execute tunefs.ocfs2 -N [number of nodes] /dev/my-block
- and mount the flesystem


Below you can see the number of slots is changed from 4 to 7.



[root@nlblade07 ~]# tunefs.ocfs2 -q -Q "%N" /dev/sda
4

[root@nlblade07 ~]# tunefs.ocfs2 -N 7 /dev/sda
tunefs.ocfs2 1.2.7
Changing number of node slots from 4 to 7
Proceed (y/N): y
Changed node slots
Resized journals
Wrote Superblock


[root@nlblade07 ~]# tunefs.ocfs2 -q -Q "%N" /dev/sda
7


Rene Kundersma
Oracle Expert Services, The Netherlands

About January 2009

This page contains all entries posted to Oracle XPS The Netherlands On HA in January 2009. They are listed from oldest to newest.

February 2009 is the next archive.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle