Use the D: drive as a data drive on a Windows VM
Applies to: ✔️ Windows VMs
If your application needs to use the D drive to store data, follow these instructions to use a different drive letter for the temporary disk. Never use the temporary disk to store data that you need to keep.
If you resize or Stop (Deallocate) a virtual machine, this may trigger placement of the virtual machine to a new hypervisor. A planned or unplanned maintenance event may also trigger this placement. In this scenario, the temporary disk will be reassigned to the first available drive letter. If you have an application that specifically requires the D: drive, you need to follow these steps to temporarily move the pagefile.sys, attach a new data disk and assign it the letter D and then move the pagefile.sys back to the temporary drive. Once complete, Azure will not take back the D: if the VM moves to a different hypervisor.
For more information about how Azure uses the temporary disk, see Understanding the temporary drive on Microsoft Azure Virtual Machines
Attach the data disk
First, you'll need to attach the data disk to the virtual machine. To do this using the portal, see How to attach a managed data disk in the Azure portal.
Temporarily move pagefile.sys to C drive
- Connect to the virtual machine.
- Right-click the Start menu and select System.
- In the left-hand menu, search for and select View advanced system settings.
- In the Performance section, select Settings.
- Select the Advanced tab.
- In the Virtual memory section, select Change.
- 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 Apply. You will get a warning that the computer needs to be restarted for the changes to take affect.
- Restart the virtual machine.
Change the drive letters
- Once the VM restarts, log back on to the VM.
- Click the Start menu and type diskmgmt.msc and hit Enter. Disk Management will start.
- Right-click on D, the Temporary Storage drive, and select Change Drive Letter and Paths.
- Under Drive letter, select a new drive such as T and then click OK.
- Right-click on the data disk, and select Change Drive Letter and Paths.
- Under Drive letter, select drive D and then click OK.
Move pagefile.sys back to the temporary storage drive
- Right-click the Start menu and select System
- In the left-hand menu, search for and select View advanced system settings.
- In the Performance section, select Settings.
- Select the Advanced tab.
- In the Virtual memory section, select Change.
- Select the OS drive C and click No paging file and then click Set.
- Select the temporary storage drive T and then click System managed size and then click Set.
- Click Apply. You will get a warning that the computer needs to be restarted for the changes to take affect.
- Restart the virtual machine.
Next steps
- You can increase the storage available to your virtual machine by attaching an additional data disk.