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.

2 Likes

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.

This is what I want to happen automatically, but I do not know how to do this (I am not a complete newbie, but not an expert either).

  • Shutdown VM gracefully by issuing a shutdown request.
    • this is must otherwise data will get corrupt or at the very least go missing.
  • Once the VM is shutdown, run a snapshot of the VM.
  • After the snapshot is complete, restart the VM.
  • Now run a replication task to send the snapshot to my remote TrueNAS.

Has any one got any pointers?

I know I can set a up a replication task and if it finds any snapshots it will PUSH them to the remote backup, but I do not know how to get it to look for manually created snapshots with the Naming Convention thing.

Thanks

The question is, how to make the complete TN Scale VM folder(s) visible inside a SMB share, to grab it with Veeam?
By default only Scale seems to be able to display the folders, but they are invisible on the dataset share and i haven’t found any option to do so.

While that is the safest, if you’re running on VMWare, you can use the baked in integration with TrueNAS to perform snapshots that leverage a call to VMWare Tools to quiesce the VM; this works as well as any backup application on the market that I’m aware of.

You can’t really…

Assuming you are referring to VM’s hosted using TrueNAS’s VM support, the VM disks are zvols, and the zvols are zfs devices, not files, and aren’t really present in a “share”

You can replicate them, using snapshots, and the snapshots will be crash consistent, but there is no way (currently) in TrueNAS to quiesce the guest during the snapshot process.

The alternative is to install an agent, for example Veeam, in the guest and use that to backup the contents of the guest disk.

Yes, I am referring to VMs that are hosted on TrueNAS using a type 2 hypervisor.

Unfortunately, I have now also read that these are zvols. Sorry, I assumed something different, as I am used to files, as is typical for VMware.

I am wondering what else I can do to backup these VMs in terms of infrastructure?

I can no longer replicate, as there is only one physical TrueNAS host left. The other is now a Veeam host based on W2k25 Server for various reasons.

Snapshots are still being taken on the TN Scale host. As far as I know, the snapshots can be made visible on a dataset share. I could then back them up at file level with Veeam. But I don’t think that i would be able to completely restore these VMs from there, in case the TN storage pool on which the TN VMs are located would completely break down. I don’t think that would be enough, would it?

Setting up another TN VM and then replicating it there makes no sense in my configuration, as the VM storage on which all infrastructure VMs are located is on the same pool as the two TN VMs. Replication to such a TN VM would only take up more space from the already limited fast storage.

I was also able to find and read about the Veeam Linux Agent, although not much.
It is just not clear to me whether I can then select in Veeam to only back up what corresponds to these two TN VMs.
And if that is not the case, I wonder, if the entire Linux system is backed up, how I am supposed to play this Veeam backup back to a system that is a fat server and not a VM if there was nothing on it before (disaster case)?

I have not thought of any further backup measures for the TN VMs.