Exposing physical disks to guests in Oracle VM

So my plan is to have a reliable Oracle VM hosted 11g database. I have a test machine which has limited resources but its the starting point for my learning of how to configure this correctly. I now have my Oracle VM server running and installed Oracle Enterprise Linux release 5 update 3 and before I walk through my database installation I want to prepare the data disks. I have two 200GB IDE drives and I want to use ASM to store the database across these disks. In the future when I can I intend to migrate the entire system to a much more beefy host with more RAM and better disks. But the configuration shouldn't change a great deal.

So one challenge was how do I have my virtual machine have access to data drives in the most effective manner. There are several steps to getting this working correctly.


  1. First make sure on the Oracle VM server the disks are correctly setup.

    • Ensure the drives are correctly configured in the physical machine and recognized in the BIOS/controller card. I'm using just IDE drives here which are seen in Linux as /dev/hdc and /dev/hdd
    • Setup valid partitions on these disks using fdisk. e.g.


      fdisk /dev/hdc

      Then hit p for a new partition, enter 1 for the first primary partition.
      Accept the defaults for start and end and then hit w to write this config to the partition table. This will create the partition /dev/hdc1. I did the same for /dev/hdd.
    • Create a filesystem on the partitions, do a mkfs -t ext3 /dev/hdc1 and obviously for hdd as well.

  2. Now with valid disks configured on the host, we need to setup the config file for my virtual machine to expose these two new disk partitions to the guest. Make sure your guest machine is shutdown and then edit the vm.cfg. This is found in /OVS/running_pool/nameofyourvm. In my case this file is /OVS/running_pool/50_OELr5r3/vm.cfg. Edit this file (nano vm.cfg) and locate the line starting with "disk =". It will currently point to the .img file which is your guest OS main virtual disk. Something like

    disk = ['file:/OVS/running_pool/50_OELr5r3/System.img,xvda,w']

    You need to add two new sections to this line which point to the disks you've just setup... The new line looks like this;

    disk = ['file:/OVS/running_pool/50_OELr5r3/System.img,xvda,w',
    'phy:/dev/hdc,sdc,w',
    'phy:/dev/hdd,sdd,w',
    ]


    Notice each definition is seperated by a comma. Now save the file...
  3. Start the virtual machine from Oracle VM Manager and once it's booted login via ssh. If you now do an fdisk -l you can see those partitions are now available for mounting! Here's my system;



    Disk /dev/hdc: 200.0 GB, 200049647616 bytes
    255 heads, 63 sectors/track, 24321 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/hdc1 1 24321 195358401 83 Linux

    Disk /dev/hdd: 200.0 GB, 200049647616 bytes
    255 heads, 63 sectors/track, 24321 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/hdd1 1 24321 195358401 83 Linux

Comments:

If you're planning on using ASM, there should be no reason to partition/format the physical devices. Just expose them to the guest and let ASM take care of them from inside the guest itself. Also, I usually recommend using sdX device names for physically exposed devices and xvdX and hdX for file/tap backed devices. Not a rule, just a nice way to figure out from inside the guest what sort of backing store you're using.

Posted by Avi Miller on June 03, 2009 at 11:34 AM PDT #

Hi Simon, I am in the process of preparation for a new setup with Oracle VM server 2.2.1 and Oracle VM Manager 2.2 As you have rightly suggested, I am preferring to use LUNs directly presented to my database server and some other LUNs for clustering (Oracle grid infrastructure). Now the question I have is: If I edit the vm,cfg file directly to add the phy: entries, do they appear in VM Manager as well? Is it automatically or I need to follow any particular procedure (e.g. start/stop something or export/import .. etc)? I do not have additional LUNs yet, but on a test machine I tested editing vm.cfg and adding a file: entry, but it does not reflect in the VM configuration shown via the VM Manager. Please can you help - on what is the supported and correct way to do this so as to have VM Manager and the vm.cfg in sync? Thanks

Posted by Ninad on June 01, 2010 at 08:19 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Simon Thorpe, senior consultant at Oracle, blogs about simple and useful tips when working with Oracle technology.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today