For some reason I do not really quite understand, I noticed that running VirtualBox
-VMs on Blockdevices rather than Container Files can make them a lot faster. On the other hand, I dont like playing arount with my partition table, as partition tables are not meant to do this and therefore not very flexible.
is flexible enough, and seems pretty fast to me, too. So I created a logical volume on which I installed my Virtual Machine, and it seems like it is really a lot faster thanusing a file container.
The first thing to do is creating a logical volume in the volume group (which is called vg0 for me), which must usually be done as root# lvcreate -n vm1 -L 60G vg0
Usually, this device is given the wrong permissions, and unfortunately, LVM seems not to have an additional mechanism for setting the device owner, so I used an additional udev
-rule. Using# udevadm monitor --property
one can see all udev-Events with their properties. By# lvchange -a n /dev/vg0/vm1
# lvchange -a y /dev/vg0/vm1
we can create and remove this volume from the /dev-tree, and udevadm will output a lot of information belonging to that device. There are a lot of unique values, I chose to use DM_LV_NAME which should be "vm1" in that case, though it might not be unique (if one has more than one volume group with equally-named logical volumes).
Lets say my user-account is called "user". Then I have to create a file /etc/udev/rules.d/99-vm1 with the contentDM_LV_NAME=="vm1", OWNER:="user", MODE:="600"
then removing the device, restarting udevd and loading it again should be sufficient for the right permissions, if not, restarting the computer should be.# lvchange -a n /dev/vg0/vm1 && killall udevd && udevd --daemon && lvchange -a y /dev/vg0/vm1
Now I should be able to access /dev/vg0/vm1 as user. By$ VBoxManage internalcommands createrawvmdk -filename vm1.vmdk -rawdisk /dev/vg0/vm1
a vmdk-file that points to that device can be created, which can then be included into a virtual machine as usual.
At least this worked for me.
The configured Virtual Machines appear to be a lot faster that way, however, one drawback is that this setup seems to slow down the host system. But I will probably continue using this setup.