Friday, April 25, 2014

Configure Storage Tiers on Windows Server 2012 R2 by PowerShell

Administrators can configure Storage Tiers by GUI in Windows Server 2012 R2. However, administrators cannot configure the write-back cache size through GUI. Plus, administrators may want to test it in a test environment. For some reasons, administrators should perform PowerShell to configure Storage Tiers.

Lab environment
  • 1 SSD with 100GB and 2 HDD with 500GB are installed in HV01

Goal
  • Create Storage Tier with a simple virtual hard disk in HV01 by PowerShell
Lab
1. On HV01, log in as administrator.
2. Launch "PowerShell" as administrator.
3. Perform "Get-PhysicalDisk -CanPool $True" to check the disks which can be added to a storage pool.


4. Perform "New-StoragePool -FriendlyName DiskPool-01 -StorageSubSystemFriendlyName (Get-StorageSubSystem).FriendlyName -PhysicalDisks (Get-PhysicalDisk -CanPool $True)" to create a new storage pool named DiskPool-01.


5. Perform "Get-StoragePool DiskPool-01 | Get-PhysicalDisk | Select FriendlyName,MediaType" to verify the media type of disks.


6. Perform "Get-StoragePool DiskPool-01 | New-StorageTier -FriendlyName SSDTier -MediaType SSD" to create SSD Tier for "DiskPool-01" storage pool.
7. Perform "Get-StoragePool DiskPool-01 | New-StorageTier -FriendlyName HDDTier -MediaType HDD".


To check the storage tier supported size for "Simple" or "Mirror" types, administrators can perform "Get-StorageTierSupportSize -FinedlyName *SSD* -ResiliencySettingName <Type>".



8. Perform "$SSD = Get-StorageTier -FriendlyName SSDTier" to store the SSD tier to a variable.
9. Perform "$HDD = Get-StorageTier -FriendlyName HDDTier" to store the HDD tier to a variable.
10. Perform "Get-StoragePool DiskPool-01 | New-VirtualDisk -FriendlyName vDisk01 -ResiliencySettingName Simple -StorageTiers $SSD, $HDD -StorageTierSizes 20GB, 80GB -WriteCacheSize 5GB" to create a new virtual disk which is named vDisk01 and then the size of vDisk01 is 100GB. We also assign 5GB write-back cache for this virtual disk.


Remark: "Write-back cache" option only can by applied by PowerShell.

11. Perform "Initialize-Disk -VirtualDisk (Get-VirtualDisk -FriendlyName vDisk01) -PartitionStyle GPT" to initialize the virtual hard disk.


12. Perform "New-Partition -DiskNumber 8 -UseMaximumSize -DriveLetter D" to create a new partition.


13. Perform "Format-Volume -DriveLetter D -FileSystem NTFS -Confirm:$false".


Using PowerShell, administrators can assign files to SSD tier by performing the following cmdlets.

1. Perform "Get-VirtualDisk -FriendlyName vDisk01 | Get-StorageTier" to check the  existing Storage Tier name of the virtual hard disk.


2. Perform "Set-FileStorageTier -FilePath <File Path> -DesiredStorageTierFriendlyName vDisk01_SSDTier" to assign the file to SSD Tier.


3. Perform "Get-FileStorageTier -VolumeDriveLetter <Drive letter name>" to verify the file in which tier.


Testing in a virtual machine environment
You can also follow the article, Why R2? Step-by-Step: Automated Tiered Storage with Windows Server Server 2012 R2, which was written by Keith Mayer to test Storage Tiers in a virtual machine environment.

For more information:




This posting is provided “AS IS” with no warranties, and confers no rights!

2 comments:

  1. Typo in
    4. Perform "New-StoragePool -FriendlyName DiskPool-01 -StorageSubSystemFriendlyName (Get-StorageSybSystem).FriendlyName -PhysicalDisks (Get-PhysicalDisk -CanPool $True)" to create a new storage pool named DiskPool-01.

    Get-StorageSybSystem shoud be Get-StorageSubSystem

    ReplyDelete