Move vm zvol with replication

I want to move a VM from one zvol to another. Here is what I have done thus far.

  1. Created a new zvol on the destination with the same size of the source zvol.
  2. Used replication (run once) to “replicate” the source zvol to the zvol on the destination

Can I now just point the VM disk config to point at the new zvol and boot it up?

1 Like

Yes.

Presumably the VM was shutdown for the final replication?

Thanks forgot the shutdown part…I will do that again then.

1 Like

Did you managed to make this scenario work?

I have replicated my VM (to another pool), but I do not see a way to attach that zvol as VM drive.

My understanding of replication is that it will make exact replica of original dataset/zvol which should then, in the case of vm, be “attachable” to VM.

You should be able to change the assigned volume in the GUI by selectimg the VM, then devices > disk > edit

If it doesn’t boot after that see the thread here:

no, it does not work, it simply does not show replicated volume in the GUI drop down list

I dont know all I did was shut down the VM then replicate it to another dataset then change the name on the “Disk” on the VM… I did it with 2 VM’s and it worked like a champ.

Sometimes, I’ve seen TrueNAS not expose a zvol in the /dev/zvol hierarchy. And in that case it won’t show up as an option in the VM ui.

I’d suggest trying a restart, if that’s not too much trouble.

Yes, this happened.

My two replication zvols are visible in GUI (within datasets) but are not visible in /dev/zvol and are not avaliable as disk options when creating new VM.

Note: I did restart the machine and now I see my replication zvol in /dev/zvol, interestingly there is a difference in path structure, before I had all of my zvols directly in /dev/zvol but now I have additional layer /dev/zvol/poolname/zvolname (for which I am almost sure did not exist before this restart).

Update (and resolution): I figured out the issue, by default, replicated zvol is set as read_only and therefore can not be used as a drive for VM, this happens because replication task had a setting which would turn replicated volume as read_only when replication task is finished (see “desination set read only policy”).

So if your zvol is made like that, you need to change read only attribute on replicated data set, when I did this, new zvol showed up and VM booted correctly from a new pool.

Conclusion is that everything works correctly, it is just that default settings will prevent write operations on replicated zvol (which is absolutely ok) and therefore my system behaved as designed.

2 Likes