Connect to the vcenter server
Create a datacenter
New-datacenter
–Location (get-folder –norecursion) –name Datacenter_Name_Here
Add the three hosts (or more) to the datacenter
Add-vmhost first_esxi
-location Datacenter_Name –user root
–password password_here
Add-vmhost second_esxi –location Datacenter_Name –user root
–password password_here
Add-vmhost third_esxi
–location Datacenter_Name –user root
–password password_here
Create the vmotion distributed switch
for the three hosts
New-vdswitch
–name vmotionswitch –location Datacenter_Name_Here
Get-vdswitch
–name vmotionswitch | new-vdportgroup –name vmotionpg
Get-vdswitch
–name vmotionswitch | add-vdswitchvmhost –vmhost first_esxi_host, second_esxi_host,
third_esxi_host
$nic1=get-vmhost
first_esxi_host |
get-vmhostnetworkadapter –physical –name vmnic2
$nic2=get-vmhost
second_esxi_host | get-vmhostnetworkadapter –physical –name vmnic2
$nic3=get-vmhost
third_esxi_host | get-vmhostnetworkadapter –physical –name vmnic2
Get-vdswitch
vmotionswitch | add-vdswitchphysicalnetworkadapter –vmhostphysicalnic $nic1
Get-vdswitch
vmotionswitch | add-vdswitchphysicalnetworkadapter –vmhostphysicalnic $nic2
Get-vdswitch
vmotionswitch | add-vdswitchphysicalnetworkadapter –vmhostphysicalnic $nic3
New-vmhostnetworkadapter
–vmhost first_esxi_host –portgroup
vmotionpg –virtualswitch vmotionswitch –IP ip_here –subnetmask netmask_here –vmotionenabled $true
New-vmhostnetworkadapter
–vmhost second_esxi_host –portgroup
vsanpg –virtualswitch vmotionswitch –IP ip_here –subnetmask netmask_here –vmotionenabled $true
New-vmhostnetworkadapter
–vmhost third_esxi_host –portgroup
vsanpg –virtualswitch vmotionswitch –IP ip_here –subnetmask netmask_here –vmotionenabled $true
Create the vsan distributed switch
for the three hosts
New-vdswitch
–name vsanswitch –location Datacenter_Name
Get-vdswitch
–name vsanswitch | new-vdportgroup –name vsanpg
Get-vdswitch
–name vsanswitch | add-vdswitchvmhost –vmhost first_esxi_host, second_esxi_host, third_esxi_host
$nic4=get-vmhost
first_esxi_host |
get-vmhostnetworkadapter –physical –name vmnic1
$nic5=get-vmhost
second_esxi_host | get-vmhostnetworkadapter –physical –name vmnic1
$nic6=get-vmhost
third_esxi_host | get-vmhostnetworkadapter –physical –name vmnic1
Get-vdswitch
vsanswitch | add-vdswitchphysicalnetworkadapter –vmhostphysicalnic $nic4
Get-vdswitch
vsanswitch | add-vdswitchphysicalnetworkadapter –vmhostphysicalnic $nic5
Get-vdswitch
vsanswitch | add-vdswitchphysicalnetworkadapter –vmhostphysicalnic $nic6
New-vmhostnetworkadapter
–vmhost first_esxi_host –portgroup
vsanpg –virtualswitch vsanswitch –IP ip_here –subnetmask netmask_here –vsantrafficenabled $true
New-vmhostnetworkadapter
–vmhost second_esxi_host –portgroup
vsanpg –virtualswitch vsanswitch –IP ip_here –subnetmask netmask_here –vsantrafficenabled $true
New-vmhostnetworkadapter
–vmhost third_esxi_host –portgroup
vsanpg –virtualswitch vsanswitch –IP ip_here –subnetmask netmask_here –vsantrafficenabled $true
Create the vsan cluster
New-cluster Cluster_Name –DRSEnabled -VsanEnabled–Location Datacenter_Name
Add the three hosts to the vsan
cluster
Get-vmhost first_esxi_host | move-vmhost
–Destination Cluster_Name
Get-vmhost second_esxi_host | move-vmhost
–Destination Cluster_Name
Get-vmhost third_esxi_host | move-vmhost
–Destination Cluster_Name
Create the disk groups:
new-vsandiskgroup -vmhost
hostname -ssdcanonicalname
disk_name -datadiskcanonicalname
disk_name,disk_name
View the results:
get-vsandiskgroup
Disconnect from the vcenter and
verify the results
Disconnect-viserver vcenter_server_name