Help rolling back a VM

Original topic on the old forums:

I did a system upgrade on a debian VM that broke a few things, and now I want to roll back the VM but I am not sure how. I have all the snapshots, I know that if I roll back a month or two, then I destroy all snapshots in between (would like to avoid that in case the rollback fails for some reason).

What is the best way to do this? Probably clone and then boot the VM from a clone to preserve the original, but how do I do that?

[nils@freenas /mnt/maindata/iohyve/www-bhyve]$ iohyve getall www-bhyve
Getting www-bhyve iohyve properties...
bargs            -A_-H_-P
boot             1
con              nmdm0
cpu              2
description      Sat Mar  4 16:29:47 CET 2017
fw               BHYVE_UEFI_CSM.fd
install          no
loader           grub-bhyve
name             www-bhyve
os               debian
persist          1
ram              4GB
size             16G
tap              tap0
template         NO
vnc              YES
vnc_h            600
vnc_ip           192.168.2.88
vnc_port         5900
vnc_tablet       YES
vnc_w            800
vnc_wait         NO
[nils@freenas /mnt/maindata/iohyve/www-bhyve]$ iohyve info
Guest                              Size  CPU  RAM  Pool
www-bhyve                          -     2    4GB  maindata
www-bhyve/disk0                    16G   -    -    maindata
www-bhyve/disk0_dpim64_gui_clone0  16G   -    -    maindata
[nils@freenas /mnt/maindata/iohyve/www-bhyve]$ iohyve list
Guest      VMM?  Running  rcboot?  Description
www-bhyve  YES   YES      YES      Sat Mar  4 16:29:47 CET 2017
[nils@freenas /mnt/maindata/iohyve/www-bhyve]$ zfs list | grep www-bhyve
maindata/iohyve/www-bhyve                                   168G  1.07T      128K  /mnt/maindata/iohyve/www-bhyve
maindata/iohyve/www-bhyve/disk0                             168G  1.08T     15.5G  -
maindata/iohyve/www-bhyve/disk0_dpim64_gui_clone0          81.4K  1.07T     7.68G  -
[nils@freenas /mnt/maindata/iohyve/www-bhyve]$ ls -al
total 2
drwxr-xr-x  2 root  wheel   3 Mar  4  2017 ./
drwxr-xr-x  5 root  wheel   5 Apr 12  2019 ../
-rw-r--r--  1 root  wheel  96 Apr  3 10:32 device.map
[nils@freenas /mnt/maindata/iohyve/www-bhyve]$ cd disk0
bash: cd: disk0: No such file or directory
[nils@freenas /mnt/maindata/iohyve/www-bhyve]$ cd disk0_dpim64_gui_clone0
bash: cd: disk0_dpim64_gui_clone0: No such file or directory
[nils@freenas /mnt/maindata/iohyve/www-bhyve]$

Response (thanks for that!) was to:

  • Shutdown the vm.
  • Clone a snapshot.
  • Point the vm at the clone.
  • Reboot vm.
  • Repeat until you find the snapshot you want.
  • Rollback to that one. Removing clones and stuff.
  • Then repoint vm at original zvol

Two questions:

  • how do I point the VM at the clone? Everything else is clear, but I don’t see how to do this. Reading iohyve/iohyve.8.txt at master · pr1ntf/iohyve · GitHub didn’t help… this VM is old and not in the GUI
  • what is www-bhyve/disk0 and www-bhyve/disk0_dpim64_gui_clone0 ? Which one do I clone?

If the second one is a clone already (i don’t remember creating it), can I find out when it was created / last updated? If it’s a clone I can probably delete it.

Not sure how to do it for a “non gui vm” but in the gui you edit the “disk” device and choose a different zvol.

But, in the shell zvols are located under /dev/zvol

(At least on scale)