In one of the previous posts How to backup NSX? I showed you how the process of NSX backup. As a best practice, I suggested aligning NSX backup with vSphere Distributed Switch backup. Today I will show you how to backup and restore vSphere Distributed Switch.
vSphere Distributed Switch backup using vSphere Web Client
- Click Networking and click Actions from the main vSphere Web Client GUI.
- From the Actions menu click **Settings **and Export Configuration. Choose Distributed switch and all port groups. This allows us to have all settings exported and have full backup of vDS.
- The final step is to save exported backup on the local disk.
- Give the file meaningful name like backup_DATE_vCenter_vDS_NAME.zip.
vSphere Distributed Switch backup using PowerCLI
Once we saved the backup using vSphere Web Client we can do the same with PowerCLI. Why would you do it from PowerCLI? The answer is automation. Backup using PowerCLI means you can schedule it as scheduled task and run it periodically.
Use the following one-liner to export all vDS from vCenter Server.
Get-VDSwitch -Name vDS | Export-VDSwitch -Description "vDS Backup 15.05.2017" -Destination "c:\vDS_backup.zip"
Where vDS is the name of the switch and vDS_backup.zip is the backup filename.
Of course, there are other (better or more complicated/sophisticated) ways to do it. Please check below blog articles for other ways to backup vDS using PowerCLI:
vSphere Distributed Switch restore using vSphere Web Client
On the vDS where will we try restore I created two PortGroups. I will delete the whole vDS from Web Client and then we will restore it from the backup.
As you see my inventory has only one vDS.
Navigate to vCenter Server level and click Actions/ Distributed Switch / Import Distributed Switch.
What we have to do is to point to backup file previously created. I selected Preserve original distributed switch and port group identifiers. It is done to force vCenter Server to assign the same value as the Managed Object ID to the key property during port group creation. Some applications might rely on port group identifier.
On the Ready to complete section we have a short summary of vDS, its uplinks and port groups. Hit Finish to finalize Distributed Switch import/restore.
The Distributed Switch is successfully restored from the backup.
vSphere Distributed Switch restore using PowerCLI
Restore is nearly as easy as backup using PowerCLI. Simply execute one-liner listed below.
New-VDSwitch -BackupPath c:\vDS_backup.zip -Location SDDC -KeepIdentifiers:$true
Where -BackupPath is path to vDS backup file, -Location is datacenter we restore vDS to and -KeepIdentifiers:$true preserves port groups IDs.
I hope you enjoyed this article about how to backup and restore vSphere Distributed Switch.