In Azure on windows VMs, D:\ drive is reserved for pagefile and any data you store on this drive will be deleted. But there are few apps or you have jobs on your on-prem that have been hard coded to use the D drive as data disk. Rather changing the drive path in your jobs it is easy to change the pagefile drive to a different drive.
So How do we move the pagefile to a different drive and rename the D drive to a drive.
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, select 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, select 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.