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
5) The following screen will pop up. Select GPT and press OK
6) The Disk Management screen will look like the screenshot below
7) To relocate the Windows Page File (pagefile.sys) open Control Panel – System – Advanced system settings
8) Under Performance select Settings… Select the tab Advanced. Under Virtual memory select Change…
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
10) A System Properties page pops up, where you need to click OK
11) Restart the VM to apply the changes
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:
14) Right-click on D, the Temporary Storage drive, and select Change Drive Letter and Paths to change the drive letter to E:
15) Create a New Simple Volume… on Disk 2 and assign it to the drive letter D:
16) After all adjustments are made, Disk Management should look like this
17) Now you can move the Windows Page File back to the Temporary Storage now assigned with the drive letter E:
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.
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.
That ends this blog post. Till next time!
Wim Matthyssen (@wmatthyssen)