What is the most appropriate way to do backup of a VM in a TrueNAS scale system?

Hi there,
Long story short - I have 4 pools:

  • boot-pool (2 SSD disks in mirror)
  • zpool-ssd-01 (2 SSD disks in mirror)
  • zpool-nvme-01 (1 NVME disk stripe)
  • zpool-hdd-01 (4 HDD stripe+mirror)

I plan to store some VMs in the NVMe pool, and yeah, for sure I will do regular snapshots. But snapshots are not backups, and the snapshots are stored in the same pool/disk.

So the question is, what is the official way to backup these VMs safely on another pools (for instance). I don’t have another system so, replication task is not an option here.

Yeah I know you might say that, TrueNAS is not a hypervisor and is not intended to be, but as it is providing such virtualization capabilities, it should provide a way of backing up a VM, right =]]

Thanks in advance.

You can do local replications.

AFAIK, doing a snapshot while the VM is active runs the risk of catching the VM or the applications it is running in an inconsistent state. The only way to be sure is to shut the VM down before doing the snapshot unless the VM and applications have been designed and tested to be 100% recoverable.

That said, in practice, people seem to do it all the time and reports of corrupted VMs seem rare so maybe it’s not that risky in the real world for most VM/app combinations.

1 Like

I have created a replication task for the moment. It says that it will create a snapshot. Wondering is it going to perform full sync every time, probably yes.

@tannebil your are completely right.Theoretically this could happen, that’s why hypervisors usually use guest-agent and instruct the OS to perform flush to disk before the snapshot activity.

That helps but it’s still no guarantee that the specific application being used was coded in a way that doesn’t leave it an unrecoverable state. Highly likely it will be OK, it likely is not the same thing as 100% sure.

For example, when a backup is made of a Parallels VM is made on macOS, the VM can be suspended where it basically suspends the machine and snaps off a backup image and includes a copy of current memory to a temporary location on the VM. If it is recovered, it can do “perfect” state restoration and nothing will be lost. However, the RAM backup is “pinned” to the physical machine, so if you have to recover on a different machine, you will not get state restoration and the VM will restart as a reboot. Parallels recommends that if you want a 100% clean backup every time, you shut the VM before doing the backup.

It’s not that big a deal in most cases with Parallels because, at least in the world of APFS, you can shutdown, make a copy on the same volume instantly, and restart which normally doesn’t take more than a couple of minutes. Whenever practical, this is the approach I take with my Proxmox VMs and CTs.

I’m not sure how I’d even do this with TrueNAS Scale which is one reason on my list of many reasons that I don’t use it as a primary hypervisor. My initial job in corporate IT many years ago was writing application automated restart/recovery JCL and being shocked by the way many application programmers blithely assumed their applications would cleanly restart from any crash. At least until they got called out at 3am to fix it when it didn’t and then got yelled at because their app failure meant that batch did finish on-time.

Fortunately, it appears that a lot of homelab apps are largely stateless so I don’t worry too much about them recovering cleanly from even an OS crash. But that’s not the same as saying I’m 100% confident that it will never be an issue.

I suppose it depends on what kind of VM, etc. For example, I run HomeAssistant in a VM. So, how do I back it up? I use the HomeAssistant Backup feature from within the VM. I also have a Windows VM, well, I use it’s backup feature also.

I do additionally use replication.