Bare Metal restore of vmware cluster.

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

K D

Well-Known Member
Dec 24, 2016
1,439
320
83
30041
This is the scenario I am trying to solve.

4 node esxi cluster with vcenter and several vms on 4 physical hosts.

I want to repurpose the 4 hosts temporarily for something else.

Is there a way I can backup the entire setup before I format all disks and restore my vsphere setup as is after I'm done with my other project?

One possible solution I could think of is to move all vms to an nfs share and delete all local datastores. Shutdown everything and just unplug the USB drives containing esxi.

Afterwards, just plug them back in and boot. Everything should come back online as is. I will just have to reconfigure the local datastores.

Will this work? Any other options?
 

realtomatoes

Active Member
Oct 3, 2016
252
32
28
44
You’ll have to reconfigure your datastores but yes, that will work.


Sent from my iPhone using Tapatalk
 

Marsh

Moderator
May 12, 2013
2,648
1,499
113
@KD
If you use powercli script to deploy and config ESXi servers.
then you just re-run the same powercli script to config the portion that you need.

In this case , setup datastore .

I also use deployment script as my documentation when my memory failed me.
 

K D

Well-Known Member
Dec 24, 2016
1,439
320
83
30041
I'm very much an esxi novice. PowerCLI is one of the things that I have no clue about and am just learning .
 

Rand__

Well-Known Member
Mar 6, 2014
6,636
1,768
113
Do you need to repurpose everything?
I'd
-Document names and datastore distribution
-Move all VMs off
-Take out ESX boot drives
-Proceed with other project which overwrites datastore disks
-Move in ESX boot drives
-Recreate datastores per documentation

Edit: Just reread your post and I see thats what you planned - so yes that would work :)
 
Last edited:

Marsh

Moderator
May 12, 2013
2,648
1,499
113
@KD
Here is sample that I used to create NFS storage

# Physical ESXi host login info
$VIServer = "pESX9.local.lab"
$VIUsername = "root"
$VIPassword = "Passw0rd"

$pEsxi = Connect-VIServer $VIServer -User $VIUsername -Password $VIPassword -WarningAction SilentlyContinue

# NFS config
$nfserver = "192.168.1.74"
$nfspath1 = "/volume1/ESXTMPL"
$datastorename = "nX4TMPL"
New-Datastore -VMHost $VIServer -Name $datastorename -NFS -NFSHost $nfserver -Path $nfspath1

I use the same script everywhere by changing relevant IP , hostname , sharename
 
  • Like
Reactions: K D

Rand__

Well-Known Member
Mar 6, 2014
6,636
1,768
113
@Marsh - is there a way to convert a running config into a script to recreate?

I mean I can backup a config o/c and reload that on a newly installed box, but a script with all the settings would be way cooler
 

K D

Well-Known Member
Dec 24, 2016
1,439
320
83
30041
@Marsh - is there a way to convert a running config into a script to recreate?

I mean I can backup a config o/c and reload that on a newly installed box, but a script with all the settings would be way cooler
This would be great to have.
 

Marsh

Moderator
May 12, 2013
2,648
1,499
113
@rand

I used to configure the ESX host by hand because it is so easy.
Then , I started using powercli script to create ESXi host, I paid with time first , then rip all the time saving later.

There are many wonderful examples of powercli deployment scripts on the NET.
My intend is to show it is not complicated . It save me lots of time to search for NFS server IP , data storage name.

Example to create vswitch

$vSwitchName = "Internal1"
$vSwitch = New-VirtualSwitch -VMHost $VIServer -Name $vSwitchName
New-VirtualPortGroup -VirtualSwitch $vswitch -Name $vSwitchName
Get-VirtualSwitch -Name $vSwitch | Get-SecurityPolicy | Set-SecurityPolicy -AllowPromiscuous $true
 

Rand__

Well-Known Member
Mar 6, 2014
6,636
1,768
113
Yes I dabbled into it a bit but in the end I always stayed with esxcli ;)
 

Marsh

Moderator
May 12, 2013
2,648
1,499
113
I was the same way, then I figured that I need to make the jump couple years back.
Powercli is more powerful and is the future.

The up side is that I could rip apart my vSphere homelab , rebuild it with few keystrokes including vCenter deployment.

I don't need to buy the $200 per year eval license.
 
  • Like
Reactions: nthu9280

Rand__

Well-Known Member
Mar 6, 2014
6,636
1,768
113
Nice:)
I assume this would work with dvswitch as well? Can you join a host to a dvswitch,set host ip's at vmk level as well as the uplunk interfaces?
 

Marsh

Moderator
May 12, 2013
2,648
1,499
113
These links are good read.
Back to Basics – Creating and Managing a Distributed Switch with PowerCLI (9 of 9)

Create dvswtich from csv file , very useful for cluster creation
Mass creation of vDS portgroups using PowerCLI « Yaztech
http://yaztech.co.uk/blog/?entry=entry150525-000515
Don't forget
NESTED VIRTUALIZATION
vGhetto Automated vSphere Lab Deployment for vSphere 6.0u2 & vSphere 6.5

Created entire lab with vCenter and vsan cluster , in 20-30 min.
You could study the script and use the part that you need.
 
  • Like
Reactions: K D

K D

Well-Known Member
Dec 24, 2016
1,439
320
83
30041
Learnt about scripted installs. It was very easy to put together a file that setup a host including all config that I needed. Took about 10 mins of work to install esxi on 4 hosts. Now to learn how to do the same for vcenter using powercli.

ESXi scripted install