Category Archives: Veeam

How to backup vRealize Automation 8.x using Veeam

In this blog post I am going to dissect backing up vRealize Automation 8.x using Veeam Backup and Replication.

- Understanding the backup methods
- Performing an online backup
- Performing an offline backup

Understanding the Backup Methods

Reading the VMware documentation around this subject can be somewhat confusing at times. And if you pay attention, there are subtle changes between the documents as well. Lets break this down.

  • vRealize Automation 8.0
    • As part of the backup job, you need to run a script to stop the services
    • This is known as an offline backup
    • Depending on your backup software, you can either do this by running a script located on the vRealize Automation appliance or by triggering using the pre-freeze/post-freeze scripts when a snapshot is taken of the VM.
    • The snapshot must not include the virtual machines memory.
    • If you environment is a cluster, you only need to run the script on a single node.
    • All nodes in the cluster must be backed up at the same time.
  • vRealize Automation 8.0.1 and 8.1 (and higher)
    • It is supported to run an online backup
      • No script is needed to shut down the services
    • Snapshot taken as part of the backup must quiesce the virtual machine.
    • The snapshot must not include the virtual machines memory.
    • It is recommended to run the script to stop all services and perform an offline backup.
      • You may also find your backup runs faster, as the virtual machine will become less busy.

Performing an Online Backup

Let’s start with the easier of the two options. Again, this will be supported for vRealize Automation 8.0.1 and higher. Continue reading How to backup vRealize Automation 8.x using Veeam

Veeam – Script finished execution with unexpected exit code: 126

This Issue

When using Veeam if you use Pre/Post freeze scripts for application aware processing, these scripts must reside on the VBR server, which uploads to the virtual machine you are protecting.

I hit an issue when running a job that I received the error;

Error: Script finished execution with unexpected exit code: 126

The Cause

I reviewed the task logs on the VBR server;

  • C:\ProgramData\Veeam\Backup\{Job_Name}\task_{VMName}.txt

You are looking for the sections [ScriptInvoker] for troubleshooting. And I found that my script was uploaded successfully, however when it was ran the Guest OS was throwing an error;

[ScriptInvoker] Failed to execute script in lin guest machine over SSH. Script path: C:\Backup\Scripts\stop-vra.sh.

bash: /tmp/d6791b89-e0b8-4cce-acec-45d682ce1f2c_stop-vra.sh: /bin/bash^M: bad interpreter: No such file or directory

I also connected to the linux machine and ran “journalctl -xe -f” whilst running the backup job and seen the same error flash up too.

The script indicates that it must be executed by a shell located at /bin/bash^M. 
There is no such file: it's called /bin/bash. The ^M is a carriage return character. 
Linux uses the line feed character to mark the end of a line, whereas Windows uses the two-character sequence CR LF. Your file has Windows line endings, which is confusing Linux. 
(Source)

You can see the full part of the task logs relating to this below.

[ScriptInvoker] Scripting mode is FailJobOnError.
[ScriptInvoker] Script enabled
[ScriptInvoker] Creating Linux invoker.
[ScriptInvoker] Starting pre-freeze script execution 
[ScriptInvoker] Running Linux script (SSH) 'C:\Backup\Scripts\stop-vra.sh'
[Ssh] SSH connection ae2f5df0-1d28-4dfc-a8a5-7ceb952af2a9 to server 192.168.200.39 created successfully
...
[ScriptInvoker] SSH connection is established (192.168.200.39).
[ScriptInvoker] Exception thrown during script execution (SSH).
[Ssh] Connection ae2f5df0-1d28-4dfc-a8a5-7ceb952af2a9 - [host: '192.168.200.39', port: 22, elevation to root: 'no', autoSudo: no, use su if sudo fails: no, host name: sc-dc1-vra001.simon.local, IPs: [192.168.200.39], AuthenticationData: [UserName: root, AuthTypes: [KeyboardInteractive, Password]]] is disposing.
[ScriptInvoker] Failed to execute script in lin guest machine over SSH. Script path: C:\Backup\Scripts\stop-vra.sh.
bash: /tmp/d6791b89-e0b8-4cce-acec-45d682ce1f2c_stop-vra.sh: /bin/bash^M: bad interpreter: No such file or directory
(System.Exception)
at Veeam.Backup.SSH.CSshCommandResult.GetAnswer(Boolean trimAnswer, String failText, Boolean checkStdErr)
at Veeam.Backup.Core.CSshScriptInvoker.RunScript(CSshScriptFile scriptFile, TimeSpan timeout, Boolean collectLogs, String stdOutFilePath, String stdErrFilePath, Boolean checkStdErr, Int32& exitCode)
at Veeam.Backup.Core.CSshScriptInvoker.ExecScriptInner(String localPath, TimeSpan timeout, Boolean collectLogs, String stdOutFilePath, String stdErrFilePath, Boolean checkStdErr, Int32& exitCode)

[ScriptInvoker] Failed to execute script over SSH, failing over to VIX.
bash: /tmp/d6791b89-e0b8-4cce-acec-45d682ce1f2c_stop-vra.sh: /bin/bash^M: bad interpreter: No such file or directory

...
[ScriptInvoker] Running Linux script (VIX) 'C:\Backup\Scripts\stop-vra.sh'
[ScriptInvoker] Linux script exit code = '126'

The Fix

The fix is quite easy, either change your text editor to show the correct line endings.

Or create the script on a Linux machine and copy it to your VBR Server.

To fix this issue in your text editor

Notepad++ 
Edit --> EOL Conversion --> UNIX/OSX Format

Eclipse  
File > Convert Line Delimiters To > Unix (LF, \n, 0Α, ¶)

Or change the New text file line delimiter to Other: Unix on Window > Preferences > General > Workspace

Sublime Text Editor
View > Line Endings > Unix 

Atom
See this guide. 

(Source)

 

Regards

Veeam Backup For Azure – Integrating with Veeam Backup and Replication

In this blog post we will cover the following topics;

- Adding your Azure Repository to Veeam Backup and Replication
- Viewing your protected data
- What can you do with your data?
- - Backup Copy to another repository
- - File Level Recovery
- - Veeam Explorer - Application Item restore
- - Instant Virtual Machine recovery to vSphere and Hyper-v
- - Restore to Amazon EC2 or Microsoft Azure

The follow up blog posts are;

- Getting started with Veeam Backup for Azure
- - Configuring the backup infrastructure
- - Monitoring
- - Protecting your installation
- - System and session logs
- Configuring a backup policy
- - Viewing and Running a Backup Policy 
- - Looking at Session logs
- Restoring a Backup 
- - Viewing protected data 
- - File Level Recovery 
- - Virtual Machine Disk Restore 
- - Full VM Restore

If you have an Veeam Backup and Replication install up and running, either on-premise to protect VMware or Hyper-V workloads, or even running in a Public cloud to provide resiliency to your infrastructure, then it’s simple enough to integrate that deployment with the data protected by Veeam Backup for Microsoft Azure.

By linking your Veeam Backup for Azure repository (Azure Storage Account) to your Veeam Backup and Replication environment, you then get access to a whole host of options.

  • File level recovery via Veeam Backup and Replication console
  • Instant VM recovery to vSphere/Hyper-V
  • Restore VM to Amazon EC2
  • Restore VM to Microsoft Azure
  • Perform a Backup Copy to another location such as a Cloud Connect Partner.
Adding your Azure Repository to Veeam Backup and Replication

Open your Veeam Backup and Replication console > Go to the “Backup Infrastructure” tab, and right click on External Repositories > Click “Add external repositories”, this will open up the wizard.

Select “Veeam Backup for Microsoft Azure”

Continue reading Veeam Backup For Azure – Integrating with Veeam Backup and Replication

Veeam Backup for Azure – Configuring your first Backup Policy

In this blog post we will cover the following topics

- How a backup policy works
- Creating a Backup Policy
- Viewing and Running a Backup Policy
- - Looking at Session logs
- Summary and next steps

The follow up blog posts are;

- Getting started with Veeam Backup for Azure
- - Configuring the backup infrastructure
- - Monitoring
- - Protecting your installation
- - System and session logs
- Restoring a backup
- - Viewing protected data 
- - File Level Recovery 
- - Virtual Machine Disk Restore 
- - Full VM Restore
- Integrating with Veeam Backup and Replication
- - Adding your Azure Repository to Veeam Backup and Replication
- - Viewing your protected data
- - What can you do with your data?
- - - Restore/Recover/Protect
How a backup policy works

Veeam Backup for Microsoft Azure, allows you to create the following types of snapshots and backups:

  • Snapshots; managed & unmanaged VHDs of Microsoft Azure VMs, which includes the configuration of a VM.
  • Backups of managed & unmanaged VHDs of Microsoft Azure VMs, which includes the configuration of a VM.

When you run a backup policy (A.k.a Backup Job), the Veeam services will perform the following tasks;

  1. Retrieve the configuration of your Microsoft Azure VMs, that are selected in the policy.
  2. Create either a backup or snapshot for the Microsoft Azure VMs, depending on the policy configuration
    • Backups – Both managed/unmanaged VHDs are saved to the configured Backup Repository.
    • Snapshots
      • Managed VHDs – snapshot saved to resource group of source VM,
      • Unmanaged VHDs – snapshots saved to Azure Storage Account of source VHD

For both backups and snapshots, the VM configuration is saved to the Veeam Backup for Microsoft Azure configuration database.

The backup services running on the workers, encrypt & compresses data that you back up to backup repositories.

(Image Source)

Creating a Backup Policy

If you are in configuration mode, you can select the “exit configuration” in the top left of the UI.

Under Management, Select Policies > Add

  • Set your Policy name and description

  • Select your Azure Active Directories where your workloads are located

Continue reading Veeam Backup for Azure – Configuring your first Backup Policy

Veeam Backup for Microsoft Azure – Restoring a Backup

In this blog post we will cover the following topics

- Restoring a Backup
- - Viewing protected data
- - File Level Recovery
- - - File Level Recovery Session Log
- - Virtual Machine Disk Restore
- - Full VM Restore

The follow up blog posts are;

- Getting started with Veeam Backup for Azure
- - Configuring the backup infrastructure
- - Monitoring
- - Protecting your installation
- - System and session logs
- Configuring a backup policy
- - How a backup policy works 
- - Creating a Backup Policy 
- - Viewing and Running a Backup Policy
- Integrating with Veeam Backup and Replication
- - Adding your Azure Repository to Veeam Backup and Replication
- - Viewing your protected data
- - What can you do with your data?
- - - Restore/Recover/Protect
Viewing Protected Data

Once you have a successful backup policy run, you will find that by navigating to “Protected Data” in the left-hand navigation pane, you will find details of your protected workloads and the backups stored.

Highlighted in the purple box above, we are able to click on each of our protected virtual machines and see the details of the restore points held.

The available restore options are;

  • VM Restore
    • Restore a full virtual machine to the same or a different location. This restore uses both the VM configuration and VHD backups.
  • Disk Restore
    • Restore only a virtual machines hard drive to the same or a different location, these will not be attached to any virtual machines when the restore is complete.
  • File-Level Recovery
    • Restore of files and folders from protected instances, which are available to download to your local machine.

Below, we can see the available restore points for my “Ubuntu01” virtual machine. As the backup policy has only run once, I have a single snapshot held with the VM itself, and a single backup of the full virtual machine (VHDS and VM configuration, which are located in my configured Repository.

  • Backups – Both managed/unmanaged VHDs are saved to the configured Backup Repository.
  • Snapshots
    • Managed VHDs – snapshot saved to resource group of source VM,
    • Unmanaged VHDs – snapshots saved to Azure Storage Account of source VHD

From this view, we can select to restore the Full VM, the individual VHDs, under the Restore option, or we can perform a file-level Recovery under the second self-named option.

File Level Recovery

You can enter a file level recovery as per the above screenshot, or from the main screen by highlighting your protected VMs and clicking file level recovery.

By clicking “Change Restore Point” you will of course see the various points in time available.

Continue reading Veeam Backup for Microsoft Azure – Restoring a Backup