How to backup and restore vSphere Distributed Switch

Page content

how-to-backup-and-restore-vsphere-distributed-switch-logo

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

  1. Click Networking and click Actions from the main vSphere Web Client GUI.

    backup-vsphere-distributed-switch-1a

  2. 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.

    backup-vsphere-distributed-switch-2

  3. The final step is to save exported backup on the local disk.

    backup-vsphere-distributed-switch-4

  4. Give the file meaningful name like backup_DATE_vCenter_vDS_NAME.zip.

    backup-vsphere-distributed-switch-4

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.

  1. As you see my inventory has only one vDS.

    backup-vsphere-distributed-switch-5

  2. Navigate to vCenter Server level and click Actions/ Distributed Switch / Import Distributed Switch.

    backup-vsphere-distributed-switch-6

  3. 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.

    backup-vsphere-distributed-switch-7

  4. 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.

    backup-vsphere-distributed-switch-8

  5. The Distributed Switch is successfully restored from the backup.

    backup-vsphere-distributed-switch-9

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.

Summary

I hope you enjoyed this article about how to backup and restore vSphere Distributed Switch.