Step by step: Change the drive letter of the Temporary Storage on an Azure IaaS v1 VM

January 20, 2016 at 7:02 pm in Azure, Cloud, IaaS by Wim Matthyssen

 

Last month I was working for a customer who wanted to migrate some existing virtual machines (VMs) to Azure with data and applications stored on the D: drive. In the same process he wanted to upgrade from W2K8 R2 to W2k12 R2 and keep those same drive letters in place. So all VMs had to be built from scratch on the Azure IaaS platform. But like you all probably know, each new VM on Azure gets a Temporary storage disk (scratch disk) with drive letter D: So I had to come up with a workaround to use the D: as a data/application drive, which can be found below.

If you’re interested, you can find more info about the Temporary Disk via following link: http://blogs.msdn.com/b/mast/archive/2013/12/07/understanding-the-temporary-drive-on-windows-azure-virtual-machines.aspx

Before we start, two things to keep in mind:

  • The Temporary Storage drive (D:) on an Azure IaaS VM hosts the page file, so this has to be relocated before the drive letter can be changed.
  • If you attach an empty disk to an Azure VM always use the maximum size of 1 TB. When you format this disk inside the VM, always choose quick format. This way data only actually written is stored and that is what you’re charged for. This will minimize your costs.

1) Create the VM. If you do not know how follow this link: https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-tutorial-classic-portal/

2) Attach an extra data disk to the VM

3) Use RDP to logon to the VM

4) Open Disk Management with choosing Run and typing diskmgmt.msc

clip_image001

5) The following screen will pop up. Select GPT and press OK

clip_image002

6) The Disk Management screen will look like the screenshot below

clip_image004

7) To relocate the Windows Page File (pagefile.sys) open Control Panel – System – Advanced system settings

 

clip_image006

8) Under Performance select Settings… Select the tab Advanced. Under Virtual memory select Change…

 

clip_image007

clip_image008

9) Select the C drive and then click System managed size and then click Set. Select the D drive and then click No paging file and then click Set. Click OK

 

clip_image009

10) A System Properties page pops up, where you need to click OK

clip_image010

11) Restart the VM to apply the changes

clip_image011

clip_image012

12) When the VM is rebooted, use RDP to logon to the VM and open Disk Management again

13) Right-Click the CD-ROM (E:) and select Change Drive Letter and Paths to change the drive letter to Z:

clip_image013

clip_image014

clip_image015

14) Right-click on D, the Temporary Storage drive, and select Change Drive Letter and Paths to change the drive letter to E:

clip_image016

15) Create a New Simple Volume… on Disk 2 and assign it to the drive letter D:

 

clip_image017

clip_image018

clip_image019

clip_image020

clip_image021

clip_image022

16) After all adjustments are made, Disk Management should look like this

clip_image024

17) Now you can move the Windows Page File back to the Temporary Storage now assigned with the drive letter E:

clip_image025

18) To apply the changes, reboot the VM

19) After the reboot, login to the VM and validate if everything is working fine and you don’t see a message like shown in the screenshot below.

clip_image026

20) To check if everything is still OK when the VM is de-provisioned, SHUT DOWN the VM from the Azure Classic portal. In this way it comes in the Stopped (Deallocated) state. Afterwards START the VM from the portal. In this case your VM will get re-deployed with its specific configuration and the Temporary Storage will be wiped, and your VM could be brought up on a different Hyper-V host in the Azure Datacenter. If everything is OK, the drive letter change for the Temporary Storage is OK and you can use this VM in production.

clip_image028

That ends this blog post. Till next time!

Wim Matthyssen (@wmatthyssen)

Share on LinkedInTweet about this on TwitterShare on Google+Share on Facebook