Virtualization: VirtualBox

Virtual machines on ZFS (ZVOL)

by ross at 12:31:15 on December 6, 2016

Prepare

My ZFS pool is system, first I will create /vm filesystem where I will put virtual machines to:

# zfs create system/vm

In order to create ZVOLs with proper permissions, add to /etc/devfs.rules:

[system=10]
add path 'zvol/system/vm/*' mode 0660 group operator

This will add write permission for the group operator. Add yourself to this group and relogin.

Make sure you have in /etc/rc.conf:

devfs_system_ruleset="system"

Apply new config:

# service devfs restart

Create ZVOL

Now new ZVOL for virtual machine deb8 (30 Gigs):

# zfs create -V 30G system/vm/deb8
# VBoxManage internalcommands createrawvmdk \
  -filename /home/ross/deb8.vmdk \
  -rawdisk /dev/zvol/system/vm/deb8

The second command will create deb8.vmdk file (change the path) which is just a few bytes and contains a reference to the ZVOL. Use it when creating new virtual machine.

 

Comments