1.1 Challenges and Solutions
In QTS 4.2, the snapshot function in Storage Manager supports not only volumes, but also iSCSI LUNs to rapidly back up and restore your valuable data.
The challenge when creating a LUN snapshot is to ensure that all data is included, such as unsaved application data, buffers, memory and logs.
The solution provided by QNAP is an Application Consistent option for iSCSI snapshots while using QNAP Snapshot Agent for Windows Server or VMware vCenter. It allows the NAS to communicate with the remote server to ensure that you can have a complete backup using our QNAP snapshot function.
This application note is suitable for anyone using a QNAP NAS as an iSCSI target to create an iSCSI LUN for other devices or virtual machines. Some terms in this document will not be explained in detail.
2. How to Start
2.1 How it works
QNAP Snapshot Agent is created mainly to allow taking Application Consistent snapshots for an iSCSI LUN, while at the same time it also provides a VSS Hardware Provider feature.
In the first workflow below, whenever you need to take a snapshot on a iSCSI LUN from the NAS, the agent will inform the remote server to flush all the data into the iSCSI LUN (for Windows Server) or to take a virtual machine snapshot before the iSCSI LUN snapshot (for VMware), therefore when a snapshot is taken from the NAS, it will contain all the necessary application data to ensure a consistent snapshot.
- Microsoft Hyper-V Server will create a VM checkpoint including the memory to avoid data loss and to ensure a consistent state in the snapshot.
- SQL Server will flush the database logs on the disk to ensure a consistent state in the snapshot.
- VMware will create a VM snapshot for each VM located in the LUN to ensure a consistent state in the snapshot, as seen below:
Furthermore, QNAP Snapshot Agent also includes VSS Hardware Provider for Windows Server. If you want to conduct a backup job for an iSCSI LUN from Windows with backup software* that supports VSS, the VSS Hardware Provider will allow to use NAS ROW (Redirect on Write) instead of Windows COW (Copy on Write) to take the snapshot on the Windows Server and therefore increase the backup efficiency.
*The backup software must support VSS Snapshot.
2.2. System Requirements
- You must use QTS 4.2 (or later) to use Snapshot Agent.
- QNAP Snapshot Agent is only supported by Windows Server. In this document we use Windows Server with GUI to demonstrate the Snapshot Agent.
- Except from Windows Server, VMware vCenter is also needed when you need to use Snapshot Agent for virtual machines deployed in VMware.
To use Snapshot Agent, you must open the incoming TCP port 11169 on Windows Server. Please follow the guidelines provided by Microsoft to open the port. It may also be necessary to use Group Policies if your server is a member of Active Directory and the firewall is controlled by GPO. Please refer to the following pages provided by Microsoft to conduct these operations:
- It is strongly recommended to use a fixed IP address on the NAS.
2.3. Known Limitations
- To take an application consistent snapshot for a virtual machine in Windows Hyper-V or VMware, the VM configuration, disk, and snapshot/checkpoint must be located on the same iSCSI LUN to be included in the snapshot.
- Snapshot Agent cannot be installed if SMI-S Provider is already installed on the server.
- Snapshot Agent does not support Extents function in VMware, the datastore must have only ONE iSCSI LUN.
- Snapshot Agent does not support a LUN that is mapped to a target with multiple LUNs
- Snapshot Agent does not support a LUN that connected with MPIO.
- Snapshot Agent does not support a LUN that is mapped to a target with CHAP.
- During reverting, Snapshot Agent only reverts VMs that are currently registered in vSphere Inventory. If a VM has already been deleted in vSphere, Snapshot Agent will not add the VM to the inventory.
2.4. Download and Install Snapshot Agent
Please go to the QNAP Download Center > Utility to download our Snapshot Agent:
To install Snapshot Agent, “.Net Framework 3.5” must be installed and enabled in “Application Server” on the Server Manager. To install this feature, go to “Server Manager” > “Add roles and features” section and select “Application Server” at the Roles section and “.Net Framework 3.5 feature” in the Feature section.
When this feature's installation is confirmed, open the Snapshot Agent application file to start the installation. After completing the installation, you should see a shortcut called QNAP Agent Manager on your desktop.
3. Configure Snapshot Agent
3.1. Configure Snapshot Agent in Windows Server
Once you have completed the Snapshot Agent installation, open the “QNAP Agent Manager”. You will need to add the QNAP NAS that your Windows Server is using as iSCSI storage by providing the IP address or by clicking “Scan NAS” to directly let the agent find the NAS on the local network.
After inputting or selecting the QNAP NAS, you will be asked to provide your NAS login credentials, to confirm the port for the connection, and to enable the functions you want to use. In this example, we have selected both VSS H/W provider and Snapshot Agent for Windows, then click “Ok” to confirm these settings. The Snapshot Agent will connect to the QNAP NAS and you can see the NAS been added to the list on the start page.
3.2 Configure Snapshot Agent for vCenter
To back up iSCSI LUNs that are being used for virtual machines in VMware, you can go to “VMware Settings” in Agent Manager. In vCenter Credential settings, please input the IP address of your vCenter Server, the account/password of your Single Sign On, and select how VMware should take a snapshot for its virtual machine when receiving a request from the NAS.
After finishing, now when you add a QNAP NAS to QNAP Agent Manager, the option “Snapshot Agent for VMware” will be enabled, or you can right click on any existing NAS and select “Edit” to enable this option.
4. Take an iSCSI LUN snapshot
4.1. Take iSCSI LUN Snapshots with Windows Server
It is possible to check if the agent is connected to the QNAP NAS correctly from the NAS UI. Open your web browser, log into QTS, and enter “Storage Manager”. In “iSCSI Storage” > “Snapshot”, open the menu “Snapshot Agent”. A list will be displayed to let you see all the Snapshot Agents that are currently connected to the NAS.
To take an Application Consistent snapshot, in “iSCSI Storage” please select a iSCSI LUN, and from the “Snapshot” dropdown button select “Take a Snapshot”.
When the confirm window displays, select "Application Consistent" in "Snapshot Type" and click "OK" to start taking the snapshot.
Note: “Crash Consistent” snapshots will not contact the remote server before taking the snapshot as they are just standard NAS snapshots.
When taking an Application Consistent snapshot, the QNAP NAS will send a request to Windows Server. It will flush all the related data into the iSCSI LUN before the snapshot.
In the following example, using Hyper-V, the iSCSI LUN contains a virtual machine that is running 24/7. When using the snapshot function from the NAS, with the Application Consistent option, the Windows Server receives the request from the NAS and creates a checkpoint of the VM.
This can be visible for a short time on the Hyper-V Manager interface*: The status of the VM changes while creating the checkpoint. The VM state, memory and disk will be included in the iSCSI LUN snapshot.
*The VM configuration, disk, and checkpoint must be located on the iSCSI LUN to be included in the snapshot.
*Depending on the Hyper-V version, the UI may be different.
4.2. Take iSCSI LUN Snapshot with VMware
The operations needed to take a snapshot for iSCSI LUNs with VMware are the same as Windows Server. Log into QTS, go to the “Storage Manager”, and in “iSCSI Storage” select the iSCSI LUN that has been used for storing virtual machines in VMware. Select “Snapshot” > “Take a Snapshot”.
When receiving the snapshot request from the QNAP NAS, vCenter will take a VMware snapshot for each virtual machine that is stored in the NAS iSCSI LUN and will store these snapshots at the iSCSI LUN. Afterwards, the NAS will take another application consistent iSCSI LUN snapshot which includes VMware snapshots for each virtual machine. This action is visible in the Tasks section of the vSphere Web Client. The VMware snapshots will be removed once they are included in the iSCSI LUN snapshot.
*Depending on vSphere Web Client version, the UI may be different.
It is also possible to use “Snapshot Manager” or “Snapshot Replica” to create a scheduled backup job. The “Application Consistent” option is available.
4.3 Revert a Snapshot
You can revert an Application Consistent snapshot to iSCSI LUN just as reverting a snapshot to a NAS volume. To check if a snapshot is application consistent, select a LUN and open “Snapshot Manager”. In list view, you can see if the snapshots taken with Snapshot Agent are application consistent.
To revert a snapshot for a iSCSI LUN that is connected to Windows Server, you will need to first disconnect the LUN, then select the LUN and check “Snapshot” > “Snapshot Manager” to select the snapshot you want to use.
Once the revert process is completed, you can than reconnect the iSCSI LUN from the Windows Server. In case of Hyper-V, all the configurations of the virtual machines are stored in the iSCSI LUN including their checkpoints.
As for VMware, when Snapshot Agent is installed and connected, you can directly revert the snapshot of a iSCSI LUN without disconnecting the LUN as the Snapshot Agent will automatically disconnect the iSCSI LUN (Datastore) from the ESXi hosts, revert the snapshot, then reconnect the reverted LUN (Datastore) and revert VM (but it still may be necessary to manually read the VM in the inventory if the VM is deleted before reverting.) Once added, vCenter can continue using the VMware snapshot to restore the virtual machine in the iSCSI LUN, and therefore ensure that the restored virtual machines in the iSCSI LUN are application consistent.
5. VSS Hardware provider for Windows Server
Snapshot Agent includes VSS Hardware provider. To use this function, you need to have backup software that supports the VSS snapshot function. In this document, we use QNAP NetBak Replicator as an example. The first step to use VSS hardware provider function is to configure your backup software to enable VSS and allow the software to create snapshots. After finishing these settings, you can use the backup software to create a backup job for an iSCSI LUN on QNAP NAS.
When the backup software uses VSS to create a snapshot, the snapshot will be taken on the NAS instead of Windows Server.
This can be seen on the NAS UI while the backup is in progress: in “Storage Manager” > “iSCSI storage”, you will find that another iSCSI LUN named “vss” has been created during the duration of the backup. This LUN is the snapshot that the NAS created for the backup job so the backup software will use this snapshot iSCSI LUN to back up the data.
After confirming that the backup job is completed, you will find the “vss” iSCSI LUN snapshot on the NAS has been removed by VSS components in Windows Server.