Thursday, May 14, 2015

ODA X4-2 -- ODA 2.* , Virtualization -- How to add vdisk to a Virtual Machine

If you are using ODA X4-2 , you are likely to be using ODA version 2.x..
Then you will have no command to add a vdisk to your Virtual Machines..
There is no option in oakcli..New oakcli interface comes with ODA Version 12 ..It has commands to create, show and delete vdisks, but at the moment it is not our concern :)Note that : there is no opportunity to use Oracle VM Manager..

So, in ODA Version 2.x , you need to make it manually..

What you have to do is creating a file with your desired size using dd command and then modifying your vm 's vm.cfg file manually in order to reflect this new file as a disk. Lastly, shutdown and startup your vm machine..(note that: you can hot plug the disk if you need to do so..)

The procedure is explained in DOC ID 1951279.1..

Lets make an example:

cd /u01/app/sharedrepo/vmrepo1/VirtualMachines/EBS_12_2_3_TEST_DB
dd if=/dev/zero of=cgcloud.img bs=1M count=200000    (creating an approx. 200 GB file/disk)
vi vm.cfg
Add the newly disk/file:

vif = ['']
name = 'EBS_12_2_3_TEST_DB'
extra = 'NODENAME=EBS_12_2_3_TEST_DB'
builder = 'hvm'
cpus = '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,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47'
vcpus = 8
memory = 65536
vnc = 1
serial = 'pty'
disk = [u'file:/OVS/Repositories/vmrepo1/VirtualMachines/EBS_12_2_3_TEST_DB/128111a52def477b81a1c9758e250ef2.img,xvda,w', 'file:/OVS/Repositories/vmrepo1/VirtualMachines/EBS_12_2_3_TEST_DB/cgcloud.img,xvdb,w']
maxvcpus = 8
maxmem = 65536

Dont bother the u'file..
'u' in the disk entry, i.e ['u'file:/disk/location] means unicode, as in character encoding method.
Normally, when we create a VM through OVM manager it adds virtual disks using disk=[file:/...."] entry, however this template is built for the disk to be used as unicode method, which will work perfectly as well.

So dont use "u" for your new disk..

Shutdown and Start your vm
poweroff vm machine..
Start the vm machine : oakcli start vm EBS_12_2_3_TEST_DB

That 's it, your disk is ready for use.. You can see it in fdisk.. It is the disk with the name xvdb, as we add specify it in the vm.cfg..

Disk /dev/xvdb: 209.7 GB, 209715200000 bytes
255 heads, 63 sectors/track, 25496 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Dont bother 209 GB, it is not so... Df will show its real size..

[root@ermanoda1~]# df -h
Filesystem                  Size  Used Avail Use% Mounted on
/dev/mapper/vg_ebs-lv_root   20G  3.0G   16G  16% /
tmpfs                        32G  3.9M   32G   1% /dev/shm
/dev/xvda1                  477M  102M  350M  23% /boot
/dev/mapper/vg_ebs-lv_ebs   266G  240G   13G  95% /u01
/dev/xvdb                   193G  188M  183G   1% /cloud

Note tat , we could use xm block-attach in the hypervisor level to hot plug the disk..

xm block-attach [domain ID] /path/to/image /dev/xvdb

No comments :

Post a Comment

If you will ask a question, please don't comment here..

For your questions, please create an issue into my forum.

Forum Link:

Register and create an issue in the related category.
I will support you from there.