Site Loader

Hi Everyone,

In the next two blogs I will try to give you a guide for Hyper-v in vWorkspace. This setup will give us the advantage of tiered storage and hypercache. In this first part I will tell how to configure you’re hypervisors. In part 2 I will talk about configuring vWorkspace.

For the hypervisor servers we followed the Dell guide for 95%. Dell talks about normal storage, and we will use tiered storage pools in windows.
Our server config: (Dell R720)
– 8x 600Gb 10k (two disks for OS)
– 2x 200Gb SSD 6Gb/s
– 256Gb memory
– 2x 10core (Intel(R) Xeon(R) CPU E5-2690 v2)

After I installed windows 2012 R2 (Raid-1). I configured all disk as a single virtual disk otherwise you cannot create a proper tiered storage pool in Windows.
Offcourse we are not going to click ini the open manage, I will use the commandline tool from open manage.

omconfig storage controller action=createvdisk controller=0 raid=r0 size=max pdisk=0:1:0 diskcachepolicy=enabled
Note: Repeat this line for each disk you want to use in you storage pool. Change the pdisk value!

The result will look like this:

Leave the disks this way. Storage Pools will do the rest!
So after I created 8 virtual disks we can start to create the storage pool.

Configure a Tiered Storage Pool: (in PowerShell of course)

$StoragePool = 'StoragePool'
$size = '300Gb'
$VMDiskName = 'vDisk1'
$ResiliencySetting = 'Mirror'
$subsysname = (Get-StorageSubSystem).FriendlyName

#The line uses the "Get-PhysicalDisk" cmdlet to get a PhysicalDisk object than is not yet in a (concrete) storage pool, 
#and assigns the array of objects to the $PhysicalDisks variable. We must perform this cmdlet before creating a storage pool.

$PhysicalDisks = (Get-PhysicalDisk | ? {$_.CanPool -eq "True"})
New-StoragePool -FriendlyName $StoragePool -StorageSubSystemFriendlyName $subsysname -PhysicalDisks $PhysicalDisks

#To create the teired storage it is nessesary to specify media type!

#Get Mediatype of disks
Get-PhysicalDisk |select friendlyname, mediatype, size

#Set the MediaType SAS
Get-StoragePool $StoragePool | Get-PhysicalDisk | ? {$_.size -gt $size} | Set-PhysicalDisk -MediaType HDD

#Set the MediaType SSD
Get-StoragePool $StoragePool | Get-PhysicalDisk | ? {$_.size -lt $size} | Set-PhysicalDisk -MediaType SSD

#create SSD tier
Get-StoragePool $StoragePool | New-StorageTier –FriendlyName SSDTier –MediaType SSD
#create HDD tier
Get-StoragePool $StoragePool | New-StorageTier –FriendlyName HDDTier –MediaType HDD

# getting the following error, remove existing tiers!
#
## New-VirtualDisk : Cannot process argument transformation on parameter 'StorageTiers'. Cannot convert 
## the "System.Object[]" value of type "System.Object[]" to type 
## "Microsoft.Management.Infrastructure.CimInstance".
#
## Remove-StorageTier -FriendlyName *HDD* #And *SSD*

$SSD = Get-StorageTier -FriendlyName *SSD*
$HDD = Get-StorageTier -FriendlyName *HDD*
$SSDTierSizes = (Get-StorageTierSupportedSize -FriendlyName "*SSD*" -ResiliencySettingName $ResiliencySetting).TierSizeMax
$HDDTierSizes = (Get-StorageTierSupportedSize -FriendlyName "*HDD*" -ResiliencySettingName $ResiliencySetting).TierSizeMax

#Get-StoragePool $StoragePool | New-VirtualDisk -FriendlyName $VMDiskName -ResiliencySettingName $ResiliencySetting –StorageTiers $SSD, $HDD -StorageTierSizes 183GB, 1671GB
Get-StoragePool $StoragePool | New-VirtualDisk -FriendlyName $VMDiskName -ResiliencySettingName $ResiliencySetting –StorageTiers $SSD, $HDD -StorageTierSizes $SSDTierSizes, $HDDTierSizes

The result will look like this:


The disk is almost ready! The disk must be configured properly.

#Prepare the new Data disk
#find the DVD player
$DVDDrive = Get-Volume | ? {$_.DriveType -eq 'CD-ROM'}
$DVDDriveletter = $DVDDrive.driveletter + ':'

#change driver letter of DVD player
$drive = gwmi win32_volume -Filter "DriveLetter = '$DVDDriveletter'"
$drive.DriveLetter = "F:"
$drive.put() 

#create the new disk
$disk = get-disk | ? {$_.operationalstatus -eq 'Offline'}
Initialize-Disk -Number $disk.Number
$disk | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel 'Data' -Confirm:$false

Ok the storage is configured!

Now can go to the next step, configuring the network on your server.

We have 4 nic’s in the server. Three of them will be a LACP trunk for the RDS traffic. The last one will be used for backup.

The LACP trunk is needed because each customer will get his own vlan.

Here is the code to create the team:

$ip = "10.255.251.165"
$gw = "10.255.251.129"
$dns1 = "10.255.251.121"
$dns2 = "10.255.251.122"
$prefix = "25"
$team = "NicTeam" 
$vlan = "104"
$backupnic = "NIC4" 

# the first nic is configured for initial setup of windows.
# So we have to remove the config from the first nic
#
# RDP will be disconnected until all nic’s are configured properly on your switch, remember that!


$nic = Get-NetAdapter NIC1
$nic | Set-NetIPInterface -DHCP Enabled

# creates the team
$nics = @(); Get-NetAdapter | ? {$_.status -eq "Up"} | % {$nics += $_.Name}
New-NetLbfoTeam -name $team -TeamMembers $nics[0] -TeamingMode LACP -Confirm:$false
Set-NetLbfoTeamNic -name $team -VlanID $vlan

#$teamnic = Get-NetLbfoTeam $team
#Remove-NetLbfoTeam $team

# Adds the other nic’s to the team
$teamname = (Get-NetLbfoTeam).name
$Adapters = Get-NetAdapter
foreach ($Adapter in $Adapters){
#$Adapter.name
#$Adapter.virtual
Add-NetLbfoTeamMember –Name $Adapter.Name -Team $teamname -Confirm:$false 
}

$buadapater = Get-NetAdapter | ? {$_.Name -eq $backupnic}
Remove-NetLbfoTeamMember -Name $buadapater.Name -Team $teamname -Confirm:$false

Get-NetAdapter "$team - VLAN $vlan"| Set-NetIPInterface -DHCP Disabled

New-NetIPAddress -InterfaceAlias $team -IPAddress $ip -AddressFamily IPv4 -DefaultGateway $gw -PrefixLength $prefix -PolicyStore activestore
Set-DnsClientServerAddress -InterfaceAlias "$team - VLAN $vlan" -ServerAddresses ($dns1,$dns2)

Now we can start installing and configuring Hyper-v.

Powershell:

Install-WindowsFeature -Name Hyper-v -IncludeAllSubFeature -IncludeManagementTools –Restart

Or you can follow the screenshots


Next


Next


Select the correct server


Enable Hyper-v checkbox


Enable management tools checkbox, add features


This is the result of the last enabled checkbox


Next


We configure this later!


Next


Choose your own file location


Yes, install


Ok, after the server is rebooted and Hyper-v install is completed we can create a virtual switch.

$team = "NicTeam" 
$vlan = "104"
$NetAdapterName = $team + ' - vlan ' + $vlan

#New switch including a vlan tag. If you do not do that your RDP will be disconnected
New-VMSwitch -Name External -AllowManagementOS $true -NetAdapterName $NetAdapterName
Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName External -Access -VlanId 104

Ok, Hyper-v is ready for use. Now we can start with VM’s on hyper-v

Create the first VM:

$VMlocation = "D:\vWorkpace Images\Office2010"
$VMName = "Office2010"
$VMDisk = "Office2010.vhdx"
$Disksize = 200Gb
$Network = "External"
$Mem = 32GB
$Memstartup = 16GB

#Create the fist VM
New-VM -Name $VMName -Path $VMlocation -MemoryStartupBytes $Memstartup
# vWorkspace recommended disk configuration
New-VHD -Path $VMlocation\$VMDisk -Dynamic -SizeBytes $Disksize -LogicalSectorSizeBytes 512 -PhysicalSectorSizeBytes 4096 -BlockSizeBytes 2MB
Add-VMHardDiskDrive -VMname $VMName -Path $VMlocation\$VMdisk
get-vm $VMName | set-vmmemory -MaximumBytes $mem -MinimumBytes $Memstartup -DynamicMemoryEnabled $true
get-vm $VMName | Add-VMNetworkAdapter -SwitchName $Network
get-vm $VMName | Set-VMNetworkAdapterVlan -Access -VlanId 104
get-vm $VMName | Set-VM -ProcessorCount 10

Dell vWorkspace recommends a specific disk configuration for your vhd/vhdx.

#ensure that the blocksize is 2mb or 2097152 bytes
get-vhd "C:\VirtualMachines\MyTemplate\MyTemplateOS.vhdx"

# change the VHD of the VM
New-VHD -Path C:\VirtualMachines\MyTemplate\MyTemplateOS.vhdx -Dynamic -SizeBytes 50GB -LogicalSectorSizeBytes 512 -PhysicalSectorSizeBytes 4096 -BlockSizeBytes 2MB

# If the disk is already created
Convert-VHD -Path "C:\VirtualMachines\W2012\Virtual Hard Disks\W2012.vhdx" -DestinationPath "C:\VirtualMachines\W2012\Virtual Hard Disks\W2012-2.vhdx" -BlockSizeBytes 2MB

Alright then, Part 1 is done. If I’m correct you will have a functioning Hyper-v environment on tiered storage!

See you at part 2!

Sander

https://cubik.com.tw/ click to find out more