Bulk Assigning VHDX to SSD Storage Tier With PowerShell #HyperV #RDS #VDI

In Windows Server 2012 R2 storage spaces, if there’s particular files in your environment that you absolutely know are always frequently accessed, such as a Parent VHD(X) that is used for multiple linked Child VHDs via Differencing Disks, you can specifically pin those files to the SSD tier. In this manner, Windows Server 2012 R2 doesn’t have to detect frequent access to keep the data blocks associated with those files in the fastest tier – they will always be there!

Taking a VDI deployment of pooled (non-persistent) VMs typical scenario could make sense, because you might want to map the parent VHD(X) of your master image to the SSD tier, as every pooled VM booting up reads from this file. So how can you permanently map files to a SSD or HDD storage tier?

To pin a file to the SSD tier, use the new Set-FileStorageTier PowerShell cmdlet, as follows:

To un-pin a file from the SSD tier, use the new Clear-FileStorageTier PowerShell cmdlet, as follows:

I recently rebuilt my VDI environment and I have a lot of VHD(X) files that I want to assign them to the SSD storage Tier. Once I had finished installing the operating system and had Hyper-V up and running – I wondered what is the most efficient way to get all virtual hard disks assigned would be. I ended up using PowerShell to do a bulk assign.

image

image

The result of this was that in under 10 seconds, I had all of my parent virtual hard disks back and assigned on my new Hyper-V server SSD tier. Neat!

Cheers,
~Charbel

About Charbel Nemnom 305 Articles
Charbel Nemnom is a Microsoft Cloud Consultant and Technical Evangelist, totally fan of the latest's IT platform solutions, accomplished hands-on technical professional with over 15 years of broad IT Infrastructure experience serving on and guiding technical teams to optimize performance of mission-critical enterprise systems. Excellent communicator adept at identifying business needs and bridging the gap between functional groups and technology to foster targeted and innovative IT project development. Well respected by peers through demonstrating passion for technology and performance improvement. Extensive practical knowledge of complex systems builds, network design and virtualization.

4 Comments

  1. Hi there.

    I was wondering, do you know of a way to do ‘global’ like pinning? Such as all files of one extension/type being pinned to the HDD, with all other files being pinned to the SSD?

    As backwards as that may sound, there is actually a good reason for doing it. I’m using PMS (Plex Media Server) and there is an option to have thumbnails generated. Those thumbnail files (‘.bif’ extension) take up the bulk of the space. Out of 120gb to 128gb of space used by PMS for library features, over 100gb of that are the .bif files. Those files aren’t a high priority for speed, while the other files are, as it greatly improves the access speed when browsing. Having a 120gb SSD available, even if I were to only have a third of it as part of a tier, it would be more than sufficient to store all the other files.

    So, while it may seem a bit of a request of what one would usually expect, you can see there is a legitimate reason for it. So, aside from using PS scripts to pin each and every file to the SSD (that should remain there), do you know if there is a way to accomplish what I’m looking to do?

    Don’t get me wrong, despite how the above may sound, I know you didn’t design Storage Spaces. However, since you have experience with pinning multiple files, I’m sure you are likely one of the better people to ask in regards to this idea.

    • Hello Wolfie,

      Thanks for your comment.

      Yes, you can accomplish what you are looking for but using PowerShell script only.
      This is an example:

      # Pin all *.bif file to the HDD tier
      Get-ChildItem E:\ -Recurse -Filter *.bif | %{Set-FileStorageTier –FilePath $_.FullName -DesiredStorageTier (Get-StorageTier –FriendlyName *HDD_Tier)}
      Get-FileStorageTier -VolumeDriveLetter E | FT –AutoSize

      You can schedule it to run daily to make sure that the new generated *.bif files will be pinned to the HDD tier.

      Hope that helps!
      -Ch@rbel

        • No, it’s not a separate entry for each .bif file.

          The following script will look for all .bif files that reside under the E: Drive, and then it will pin them to the HDD tier.

          # Pin all *.bif file to the HDD tier
          Get-ChildItem E:\ -Recurse -Filter *.bif | %{Set-FileStorageTier –FilePath $_.FullName -DesiredStorageTier (Get-StorageTier –FriendlyName *HDD_Tier)}
          Get-FileStorageTier -VolumeDriveLetter E | FT –AutoSize

Leave a Reply