SOLVED Rename a cloned bhyve VM zvol

pttymuth

Dabbler
Joined
Jul 1, 2013
Messages
24
Hi

I hoping to confirm if renaming the zvol for a cloned VM would cause any issues in the background with how cloned bhyve VMs are managed by FreeNAS. For example, I have a Windows Server 2016 VM that I would like to use as a "template". The VM's zvol name is vms1/Win2016GuiTemplate-yeg5d9. I have used FreeNAS to clone the VM and the resulting zvol is named "vms1/Win2016GuiTemplate-yeg5d9_Win2016GuiTemplate_clone0". Noticing that the clone's zvol name corresponds to the snapshot name given to the original zvol, I am hesitant to try renaming it, because I worry that maybe FreeNAS needs the names to correspond this way so that it can manage the clone in some way. What I would prefer to do is rename it to something like vms1/Win2016GuiTemplateMssql-disk0 and also have a few other zvols for additional disks 1-3.

Code:
root@freenas:~ # zfs list -t snapshot | grep Win2016
vms1/Win2016GuiTemplate-yeg5d9@manual-20190612            2.33G      -  13.7G  -
vms1/Win2016GuiTemplate-yeg5d9@Win2016GuiTemplate_clone0      0      -  11.8G  -
root@freenas:~ # zfs list | grep Win2016
vms1/Win2016GuiTemplate-yeg5d9                            14.1G   386G  11.8G  -
vms1/Win2016GuiTemplate-yeg5d9_Win2016GuiTemplate_clone0     8K   386G  11.8G  -
root@freenas:~ # 


I can simply try it myself, but setting up that Template VM took a whole day, so I would really prefer not to gamble with it if an answer already exists out there. Please respond if you have any advice! :)
 

pttymuth

Dabbler
Joined
Jul 1, 2013
Messages
24
Did you try it? Did it work out?

Yes, and it worked without issue! So renaming any of the zvols, even those of a clone, is fine, so long as the VM is shut down beforehand, and so long as the configuration is updated after the change.

I also discovered something else. New VM zvols all use sparse datasets. Cloning the VMs using the GUI results in non-sparse datasets for the zvols (i.e., they are the full 100G or whatever max size they are allowed to be). Instead of cloning via the GUI, I instead do a zfs send/recieve command to clone the datasets. This way, not only can I control the name of the VM "clone" dataset, but I also get space-efficient sparse datasets too. :)
 

newfreenas

Dabbler
Joined
Nov 7, 2018
Messages
30
pardon my ignorance, I also am looking to rename a zvol but cannot find documentation on doing this, I feel like I'm missing obvious documentation and cannot pick the right search term, can you point me in the right direction?
 

glauco

Guru
Joined
Jan 30, 2017
Messages
524
cannot pick the right search term
man zfs-rename
I just successfully renamed a zvol so that its name matches its virtual machine.
Before renaming, make sure the vm is shut down.
Afterwards, go to vm > devices > disk > edit and enter the renamed zvol.
 
Top