Friday, December 16, 2016

Oracle VM/XEN -- resizing Xen Virtual block Device (xvd) online.. Is it really possible?

Recently needed to extend an xvd device in a virtualized ODA X5 environment.
Note: The xvd device was attached on an ODA BASE machine.

The ODA VM and Xen Versions of the environment were:

ODA VM Version:
[root@vmsrv1 /]# cat /etc/issue
Oracle VM server release 3.2.9
Hypervisor running in 64 bit mode with Hardware Virtualization support.

Xen version:
[root@vmsrv1 /]# dmesg | grep Xen\ version
Xen version: 4.1.3OVM (preserve-AD)

Well...I had to resize the partition and the filesystem without rebooting the guest VM .
Note: I want to remind you that the guest VM was in ODA_BASE domain, bytheway.  (ODA BASE Node1)

Here is the approach that I took for this;

  • First, I extended the xvd device , actually the backend device which was a file, from DOM0..

cd/OVS/Repositories/odabaseRepo/VirtualMachines/oakDom1
dd if=/dev/zero bs=1M count=20000 >> u02.img (a 20GB extend)

  • Later on, I unmounted the relevant partition from ODA_BASE.

umount /u02


  • Then, I detached and attached the block device using xm.. I needed to do this, because there was not other way to make the ODA BASE or let's say make DOMU to see the up-to-date info about the extended disk. In other words; there was no rescan feature available for xvd devices. If it was a scsi device, we would directly rescan the scsi bus, but for xvd we have no such feature.. Note that, there is a xm block-configure command which can be executed from DOM 0 , but that command can only be used for CDROM devices. SO , I executed the following xm command from DOM 0;

 xm block-detach oakDom1 /dev/xvdb
 xm block-attach oakDom1 file:/OVS/Repositories/odabaseRepo/VirtualMachines/oakDom1/u02.img  xvdb w
   

  • After reattaching the virtual device to the guest (node 1 in OAKDOM), I checked to see its size using fdisk and ensured that the info that fdisk was giving to me, was up-to-date.

  fdisk -l /dev/xvdb

  • Lastly, I recreated the partition on the disk named xvdb to extend the current partition and used resize4fs to extend the filesystem.
  • Once my resize operations were finished, I mounted the device back to its mount point (/u02) , thus that my work was finished.

So at the end of the day, I could resize a xvd disk without rebooting the related guest machine (ODA Base node 1). However; I did umount it right?  So it was not fully online operation.

After this short real life story, I want to give my answer to one thing: Is it really possible to resize an xvd online? My answer is "Unfortuneatly, NO!"

There is no way at the moment. At least I couldn't find..
More specifically, there is no way to rescan an xvd or tell the DomU that xvd configuration is changed. (without detaching and attaching)

What can be done? Any alternatives?
YES!
Resizing an xvd based partition can be done online using LVM!

(Note that : xvd based partition != xvd device)

That is, we can always add a new xvd from DOM0 to DOMU (i.e ODA BASE nodes) using block-attach and extend our logical volumes on DOMU after that.

Ofcourse, we need to be using LVM based partitions in DOMU to be able to do this.

(Note that : the ODA BASE mount point, which come by default with ODA virtualized deployment are not based on LVM)

No comments :

Post a Comment