Confused about bhyve's virtual disks (zvols) and the parent filesystem

JaimieV

Guru
Joined
Oct 12, 2012
Messages
742
First time using the VM stuff, so I read the manual, fire up a new VM, and I use the GUI navigator to tell it to put its disks in
zvol: DataPool/VMs
where DataPool is my main pool, and VMs is one of the datasets I created inside it.

All good, install completes. After the install using the shell I take a look in DataPool/VMs and there's no content. Confusing.

Going back to the GUI, in VM Devices the hard disk is shown as being in /dev/zvol/DataPool/VMs/VWin10.f4oyha - which indeed it is, I can see using the shell. But how does this path come about? This isn't a represenatation of the DataPool I created as the base pool as it doesn't have the other content that DataPool has. There is nothing other than the "VMs" dir in /dev/zvol/DataPool.

'mount' on the command line only shows one VMs dataset, where I created it:
DataPool on /mnt/DataPool (zfs, local, nfsv4acls)
DataPool/Stuff on /mnt/DataPool/Stuff (zfs, local, nfsv4acls)
DataPool/TimeMachine on /mnt/DataPool/TimeMachine (zfs, local, nfsv4acls)
DataPool/VMs on /mnt/DataPool/VMs (zfs, local, nfsv4acls)
DataPool/iocage on /mnt/DataPool/iocage (zfs, local, nfsv4acls)

But Storage on the UI shows the virtual disk as being inside VMs:
Datapool dataset
Stuff dataset​
TimeMachine dataset​
VMs dataset​
VWin10-f4oyha zvol​
iocage dataset​
Is this just ignorance on my part as to how zvols are represented in the filesystem, showing up as "character" device files in /dev/zvol/? Or is bhyve doing something odd?
 
Last edited:

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,702
You wouldn't expect to see a zvol mounted on FreeNAS itself as it's essentially block storage mounted by the VM as a disk (possibly via iSCSI or just directly in BHYVE).

In terms of the storage "location" of that zvol, it logically resides in the place you created it, so would count towards any quota you set for the parent dataset, but the location of the file itself is "hidden" in the zvol location.

The file will be on the same pool/physical disks as the parent dataset, so it doesn't matter where it shows up in the filesystem structure in real terms.

I would normally have expected to find more detail than this somewhere in the documentation in section 9.2.11, but did not (not even as much as I have said here, which may not be 100% accurate as it's only my understanding).
 

KrisBee

Wizard
Joined
Mar 20, 2017
Messages
1,288
In this example, the process of creating a virtual machine has placed zvol bsdvm-heq1es inside dataset NasPool/VM


Code:
root@freenas:/ # zfs list | grep VM

NasPool/VM                                                9.69G  12.6G    88K  /mnt/NasPool/VM
NasPool/VM/bsdvm-heq1es                                   9.69G  21.1G  1.16G  -
root@freenas:/ # cd /mnt/NasPool/VM
root@freenas:/mnt/NasPool/VM # ls -l
total 0
root@freenas:/mnt/NasPool/VM # ls -l /dev/zvol/NasPool/*
total 0
crw-r-----  1 root  operator  0x7b Mar 21 17:45 bsdvm-heq1es
root@freenas:/mnt/NasPool/VM #


It's not mounted in the file structure and only shows when listing the zvol block devices in your pool.
 

JaimieV

Guru
Joined
Oct 12, 2012
Messages
742
Thank you both - I'd stopped worrying about it tbh, but now with your help I comprehend the way the block device is shoehorned into the filesystem :)
 
Top