Migrating VMs

jlw52761

Explorer
Joined
Jan 6, 2020
Messages
87
I have an "old" FreeNAS 11 system that I'm moving off of to my TrueNAS Scale system. On the old system, I have a couple of VM's running, and their volumes are stored in /mnt/Pool1/LocalVM. On the new system, I have a new VM running, and it's location is also on /mnt/Pool1/LocalVM. So, my question is, if I replicate my snaps of LocalVM from the FreeNAS box to the TrueNAS box, in the same location, will it destroy my existing VM on the TrueNAS box? I'm honestly not completely sure what will happen when I replicate the snapshot, will it just merge the snapshot into the location or replace? I'm hoping merge, then I can just shut down the old VMs, do a final replication, create the VMs on the new box and attach to the disks, and Bob's your uncle.
 

jlw52761

Explorer
Joined
Jan 6, 2020
Messages
87
So, I guess what I'm after is, I can create a snap of the zvol and replicate that to the new server, but can I then "decouple" the zvol from the snapshot and make it standalone again, or do I have to keep the snapshot in-perpetuity? My background with snapshots and clones is from ESXi, so my mindset is cloning a VM and not having the snapshot issue.
Not sure if after I replicated the zvol, I could then do a byte-wise copy of the zvol to a new one that has no underlying snapshot. Is this even possible? My research is not lending much.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
  • zfs snapshot pool/zvol@now
  • zfs send pool/zvol@now | <some network mechanism like ssh or nc to new system> | zfs receive pool/<some-new-name> will create a new zvol named <some-new-name> in the destination pool with a snapshot <some-new-name>@now present.
  • The zvol on the destination system pool/<some-new-name> will be writeable just fine. You can destroy the <some-new-name>@now snapshot or leave it as you see fit.
  • On the destination create a new VM and point the virtual disk device at the existing zvol <some-new-name>
  • Enjoy!
Addendum: you are aware that the output of zfs send and the input to zfs receive is just a stream of bytes? And that you are working in a Unix environment? So of course you can:
  • zfs send pool/zvol@snapshot | gzip -c >/mnt/pool/some/directory/mysnapshot.gz
  • scp /mnt/pool/some/directory/mysnapshot.gz destination:/some/place/else
  • On destination: gzip -dc /some/place/else/mysnapshot.gz | zfs receive pool/some-suitable-name-for-the-zvol
 
Last edited:

jlw52761

Explorer
Joined
Jan 6, 2020
Messages
87
Hmm, I keep getting "failed to read from stream". Going to try and do this using the GUI to replicate the snapshot, but it's odd I can't do it this way

**edit** took out the pipe in-between the ssh and zfs receive and it's working.
 

jlw52761

Explorer
Joined
Jan 6, 2020
Messages
87
That is about as slick as snot. Was able to remove the snapshot, power on the VM, edit the netplan file with the new interface name, and off to the races I go! How do I mark your post as the solution?
 
Top