[Guide] Exclude subset of VMs from "ALL VMs" VMware backup job
Last Updated: May 23, 2018 01:13AM CEST
Exclude subset of VMs by wildcard name and or path from a "ALL VMs" VMware backup job
This how-to article covers excluding subsets of VMs by wildcard name and/or folder path from an “ALL VMs” VMware backup job using NovaStor DataCenter. This configuration option allows you to always exclude specific VM name wildcards, such as “QA*” or “Test*”, and/or specified folder paths (such as /Test and /Dev) for backup. A simple configuration file is created to allow the exclusions to always remain in place, for each ESXi/vCenter Server in your environment so that those excluded VM wildcard names or VM folder paths are never included in the VMware VM backup job.
The exclusion behavior is controllable per ESXi/vCenter Server host by modification of one existing and one new configuration file, located in the 'C:\Program Files\NovaStor\DataCenter\Hiback\vmware\' folder.
- The exclusion can be performed either on a DataCenter Command Server or on a DataCenter Client, both of which would already have the VMware Proxy setting, follow the guide here, in place on that Node. From the DataCenter Command Server or DataCenter Client (which already have the VMware Proxy setting in place on that Node) load Windows Explorer and navigate to the above-mentioned folder 'C:\Program Files\NovaStor\DataCenter\Hiback\vmware\', and then turn on show file extensions in Windows Explorer so that you can view files based on their file extensions.
- In the above-mentioned folder look for all files with .ini file extension in the folder list. You should have an existing .ini file per ESXi/vCenter Server that you have configured previously in DataCenter in the VMware Proxy setting. The name of the .ini file will relate to the ESXi/vCenter Server’s DNS name or IP address. You will have one additional .ini file named 'VMware.ini', that file can be ignored as we won’t be modifying it. Locate the existing .ini file for the ESXi/vCenter Server that you want to make the exclusions for. Note: If you do not see an .ini file for your ESXi/vCenter Server in the folder then this node has not been configured with the VMware Proxy Setting and you will need to edit the node to enable the VMware Proxy Setting and start over. In our example the name of the ESXi/vCenter Server is the IP address which is '192.168.2.46'.
- Edit the existing HOST.ini file, in our example this file is already in the folder in question and is named '192.168.2.46.ini', the name of this file matches the name of your ESXi/vCenter Server name, and this file is already in place. The exclusion configuration items that you will be appending as new lines of text to this existing .ini file tell DataCenter to exclude by specific VM name patterns (wildcards), control case sensitivity, and do some more advanced regex functions related to exclusion. You will see some lines of text that are already in this file, you will be appending lines of text for the exclusion configuration below the existing lines of text.
- Create a HOST.excl, in our example this file is named '192.168.2.46.excl', which matches the name of your ESXi/vCenter Server name. The file itself contains configuration variables having to do with excluding by folder paths. You will specify one inventory path to exclude per line. This file supports * and ? wildcards. Note: If you do not need to exclude VM’s based on their folder path names then you can leave this file blank for the contents or you can choose not to create this file altogether.
In the HOST.ini file we use the following three options in the inventoryFilter namespace:
- ignoreCase: This tells the engine to ignore case when applying the exclude expressions (also in the exclude file)
- excludePathPattern: This regular expression tells the engine to exclude all VMs below the 'DataCenter/test and dev' folder that have spaces in their paths, except for those that are inside the 'EFR' and 'HFR' subfolders.
- excludeNamePattern: This expression applies only to VM names and not their full paths. Here we exclude all VMs that have 'QA' and 'test' somewhere in their VM names.
inventoryFilter.excludePathPattern="DataCenter/test and dev/(?![EH]FR/).*[ ]+.*"
The following exclude file has two patterns to exclude VMs below the 'test and dev' folder:
- The first one will exclude all VMs inside a folder named 'test and dev/QA/'
- The second one excludes all VMs inside any folder with three characters ending with 'ME'
*/test and dev/QA/*
*/test and dev/?ME/*
You should not have to restart any services to see this take effect, the changes that you make to the .ini and the .incl files should reflect without restarting any services or re-running DataCenter GUI, however for the changes to exclusions to be verified to work it is required to perform the Verifying the Exclusions steps outlined below. If you do not perform the Verifying the Exclusions steps then the backup job may still backup VMs that you excluded earlier.
Verifying the Exclusions:
To verify that the changes have taken affect to your VM exclusions, you can load the DataCenter GUI on the same machine that you created the exclusion edits on, via the Backup Jobs screen locate your VMware “ALL VMs” backup job and click on Edit Job, or create a new VMware “ALL VMs” backup job, and in the Job tab locate the VM(s)/Host(s): section of the job, where you select which VM’s to back up, then double-click on the ESXi/Server in question for the entry that displays 'All VMs' in the 'Virtual Machine' column. You can also click the Folder icon on the right of the screen to perform the same action. An example screenshot is shown below:
This will open a new window and it should be titled “VMware Host/Server/VMs Selection”.
If you are editing an existing job which was an "All VMs" job that had "ALL VMs" for the selected "Backup type:" configuration item at the top of the "VMware Host/Server/VMs Selection" screen, then you should see the ESXi/Server in question already selected in the list of items and the option for "Backup type:" will show “All VMs”. You can expand that ESXi/Server by left-clicking on that server in the list to display the VM’s on that server. The list that is presented to you here may still show the VMs that you excluded earlier, don't worry we will take care of that next by performing a Rescan of the inventory next.
In order to see the changes on the exclusions that you made on this screen you will need to click on the “Rescan inventory” button at the bottom of the screen (highlighted in red), allow the Rescan inventory function to complete which could take a few of minutes. If the “Rescan inventory” status icon seemed to animate itself forever and not look like it completed after waiting a few minutes, simply click the OK button at the bottom right and re-try the prior step again. If your exclusions are in place properly, and those excluded VMs are no longer being displayed here, then the list of VMs on the VMware Host/Server/VMs Selection screen that you are on should display the list of VM’s that will be processed for backup and not show the exclusions that you put implemented earlier. In this example my ESX/vCenter Server at 192.168.2.46 had about 30 VM’s in total but now only 5 displayed to be considered for backup after the exclusions were implemented (the majority of VM’s on this ESX/vCenter Server have QA and Test in their name and those are the two VM name wildcards I have excluded for backup on this ESX/vCenter Server). The example screenshot is shown below:
Finally, after verifying that your exclusions have worked and you have verified this by looking at the list of VMs that are part of this "All VMs" VMware backup job, where the VMs that are listed on your VMware Host are not showing any of the VMs that you excluded, at this point you can click OK on the above screen and the settings are now in place. If you make any future exclusion modifications, to exclude additional VM names or VM folder paths, or to remove an existing exclusion, make sure that you perform all the steps in the “Verifying the Exclusions” section of this guide once more, to fully apply the changes.