Backup virtual machine

adam23450

Contributor
Joined
Feb 19, 2020
Messages
142
Hi, How can I backup virtual machines to restore them simply later?
Do I have to do this via Snapshot?
 

Morris

Contributor
Joined
Nov 21, 2020
Messages
120
You can use any backup solution that will work on a physical machine as well as snapshots.
 

adam23450

Contributor
Joined
Feb 19, 2020
Messages
142
You can use any backup solution that will work on a physical machine as well as snapshots.
Is there any solution? Can I also use a replication job for a copy?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
What solutions there are depends on the guest operating system in your virtual machine. You can use - as @Morris wrote - either
  • a guest OS specific solution running inside the virtual machine - Acronis, Veem, whatever ... for Windows for example
  • snapshots for the virtual hard disk from outside the virtual machine, possibly combined with a replication task copying the snapshot to a different ZFS capable system
I do the latter. Works like a charm. Hourly snapshots are perfectly fine with ZFS.
 

swinster

Dabbler
Joined
Oct 10, 2022
Messages
26
What solutions there are depends on the guest operating system in your virtual machine. You can use - as @Morris wrote - either
  • a guest OS specific solution running inside the virtual machine - Acronis, Veem, whatever ... for Windows for example
  • snapshots for the virtual hard disk from outside the virtual machine, possibly combined with a replication task copying the snapshot to a different ZFS capable system
I do the latter. Works like a charm. Hourly snapshots are perfectly fine with ZFS.
@Patrick M. Hausen , I'm just starting out with TrueNAS and am looking into possible backup solutions with TrueNAS as the data store. This is for a home lab but I run a number of VMs (approx 30 at this time) in ESXi, which range from Windows machines (AD, Exchange SQL etc), to applications running on relatively standard Linux boxes, to more appliance-based VMs that does not have the possibility of in-machine clients.

Years and years ago, I believe Veeam had a free version of their software that allowed for snapshot VM backups (similar to what you mentioned you currently do), but today, I'm not sure if the application exists. Do you mind sharing what application you use, or technique you use?
 

swinster

Dabbler
Joined
Oct 10, 2022
Messages
26
In addition, I'm looking at the difference between TrueNAS core and scale, although I don't know if scale is going to offer anything of benefit over core for this particular application.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Do you mind sharing what application you use, or technique you use?
It's built into TrueNAS and ZFS. You just configure a snapshot task in the UI and you are all set. Frequency, retention period - all adjustable. To backup to a different system you set up a replication task, also in the UI.

I use CORE - been using FreeNAS and now the successor named CORE for more than a decade - and I am very satisfied with performance and stability. VMs can be a bit quirky sometimes but as an iSCSI or NFS store for VMware it's rock solid. It even supports creating a VMDK snapshot before snapshoting the storage, so you are guaranteed a consistent backup. Needs a paid vSphere setup, though. Not supported in free ESXi.

Make sure to read the guide to fast block storage if ESXi is your main application:
 

swinster

Dabbler
Joined
Oct 10, 2022
Messages
26
Ahhhhhh :) I have been thinking about this all the wrong way. Classic Nooob mistake. Thanks.
 

swinster

Dabbler
Joined
Oct 10, 2022
Messages
26
After reading up a little more, I think I am talking at cross purposes - or more likely I need to continue reading.....

For my setup, I have a Dell server with a PERC RAID card that utilises a bunch of 2.5" SAS SSDs and HDDs in several native volumes. ESXi then sees this hardware directly I use VMware datastores directly on these RAID volumes. At this point, TrueNAS has nothing to do with anything, so this is a relatively typical ESXi host deployment

In addition to the PERC RAID card, the server uses a more standard SATA controller to which are attached several 3.5" WD Red HDDs. I have placed the SATA controller into the passthrough mode and then run TrueNAS as a guest VM on ESXi and use this passthrough controller. The HDDs on this specific controller are then accessed directly by the TrueNAS guest VM. Currently, the vdev created within TrueNAS on this HDD is empty, but the intention is to backup the VM on the ESXI data site outside of TrueNAS to the vdev volume. I wasn't considering using TrueNAS as ESXi datastore unless, of course, that is essentially what happens if I am using the VMware Snapshots option (as per https://www.truenas.com/docs/core/coretutorials/storage/vmware-snapshots/).

When I attempt to set up the VMware snapshot and connect the TrueNAS pool with and ESXi data store, I see the following warning, which then make me worried I am doing something wrong:

1666296830741.png


Then there is the issue of a SLOG cache. Currently, the only drives exposed directly to TrueNAS are SATA HDDs, and the are allocated to a single vdev. The True guest VM exists as in a VMDK on the SAS RAID array, and whilst I could crete more VMDKs for TrueNAS on this RAID array for a log vdev, it dosn't seem like that is a good idea.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
You cannot "connect" an existing local ESXi datastore and a TrueNAS pool. You need to make your pool an ESXi datastore via iSCSI and put your VMs on that datastore. Then you can perform snapshots in TrueNAS. To TrueNAS it's local storage. TrueNAS has got no control whatsoever over a datastore local to ESXi.
 

swinster

Dabbler
Joined
Oct 10, 2022
Messages
26
You cannot "connect" an existing local ESXi datastore and a TrueNAS pool. You need to make your pool an ESXi datastore via iSCSI and put your VMs on that datastore. Then you can perform snapshots in TrueNAS. To TrueNAS it's local storage. TrueNAS has got no control whatsoever over a datastore local to ESXi.
Thanks, @Patrick M. Hausen for the clarification. I was simply not able to fully understand the use case from the documentation.

Unfortunately, this is exactly the opposite of what I wanted to achieve. I find the native PERC RAID card perfectly just fine and simply wanted TrueNAS to operate a completely independent backup storage for the VMs. I guess I will revert to my initial thought of either using an in-VM agent or something that enables ESXi to create backups to TrueNAS, such as a more traditional Veeam product.

I appreciate your input in any case.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
You might want to look into GhettoVCB - this is what I use to backup local ESXi VMs to an NFS datastore.

 

swinster

Dabbler
Joined
Oct 10, 2022
Messages
26
After a bit of a play, I have decided to punt for the Veeam Backup and Replication Community Edition. for most of the VMs I run. This seems to connect nicely to the NFS share (although TBH, I'm not 100% certain how as I never specified any credentials in Veaam, yet I added a separate user/group as both owners of the dataset in TrueNAS and added restrictive ACLs for that user/group). It also allows for incremental backups and file-based recovery, which I think is plenty good enough for what I want.

On the datasets, Sync is currently set to "standard" (I am trying to read around how this affects NFS, and if "Always" should be used). I see for VMware that connects a data store to a TrueNAS NFS share, it will sync writes, but I'm not so sure about Veeam. I am playing with a log vdev, although I am only testing at the moment as this is actually a separate VMware Virtual Disk mounted within the TrueNAS VM (within the datastore located on the SAS SSD RAID array). This is probably a no-no, but I just wanted to see if it made any difference. As this zpool is used purely for backups - I don't mind rebuilding it a few times to see what works best.

If I need other VMs backed up, I will add GhettoVCB as well.
 
Top