25 January 2018

Using Logical Volumes as disk images for virtualization

      In most scenarios, using raw devices can increase the performance. Of course, the application should know how to deal with that. Why? Because you take away the overhead that the file system can cause (again, if the application know how to deal with that).
     I see in my entire life databases having more performance because are using raw devices (disregard what the dumb people says in tongues without any proof).

What I've tested

Linux and FreeBSD Virtual machines have a significant increase of I/O performance.

What I didn't tested

Windows VMs (well windows do a shitload of I/O, probably it's a good idea if you're into this crap)
BSD VMs (not yet)
Resizing (I don't know if it's possible, I'll test later and update this post)

Recipe

  1. Create the LV that will be used (lvcreate -L size -n name_of_lv name_of_vg)

    lvcreate -L10G -n myvirtualdiskLV rootvg
  2. Format the LV into raw vmdk (VBoxManage internalcommands createrawvmdk -filename name_of_the_reference_file -rawdisk /path/to/LV)

    VBoxManage internalcommands createrawvmdk -filename /lvs/vms/myvm/linux.vmdk -rawdisk /dev/rootvg/myvirtualdiskLV
     This will create a reference file to be used in virtualbox as a disk. Don't forget to fix the permissions as needed.

No comments:

Post a Comment