Auto-unmount Veeam vPower NFS datastore

Auto-unmount Veeam vPower NFS datastore

When doing an Instant VM recovery or a Linux FLR recovery using Veeam Backup & Replication it will create a NFS share within a VMware infrastructure which allows it to power on VM’s directly from a backup file. However when the restore is done the NFS share remains in the infrastructure. This is done to speed up future recoveries.

I received the question if there was a way to auto-unmount the datastore once a restore was done. This is currently not possible but the following script will remove any NFS datastore in the infrastructure called “VeeamBackup_” on all hypervisors.

# Script to unmount Veeam vPower NFS datastore

# Fill in the information below
# vCenter server address (FQDN or IP)
$vcenter = "IP-HOSTNAME"
# vCenter Username
$user = "SOMEADMIN"
# Password
$pass = "SOMEPASS"

# DO NOT TOUCH BELOW!!

# Connect to vCenter
Connect-VIServer -Server $vcenter -Username $user -Password $pass | Out-Null

$hosts = Get-VMHost
foreach ($VMHost in $hosts) {
$veeamshare = Get-Datastore | where {$_.type -eq "NFS" -and $_.name -Match "VeeamBackup_*"}
Remove-Datastore -VMHost $VMHost -Datastore $veeamshare -confirm:$false
}

# Disconnect from vCenter
Disconnect-VIServer -Server $vcenter -Confirm:$false | Out-Null

You can automate this task by running the script as a scheduled task.

Enjoy!

Niels Engelen on GithubNiels Engelen on Twitter
Niels Engelen
Working as a Principal Analyst in Product Management for Veeam Software with an interest in anything virtual and cloud with a strong focus on AWS, Azure and Microsoft 365. He is also a VMware Certified Professional, a Veeam Certified Architect and gained the VMware vExpert award (2012-2022).

12 thoughts on “Auto-unmount Veeam vPower NFS datastore

Comments are closed.

Comments are closed.