Skip to content

siege089/azure-resize-vm-disk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

Resize Azure VM Disks

Shrink OS Disk

Prereqs

Steps

  • RDP into VM
  • Open Computer Management
  • Open Disk Management
  • Check the amount of free space on the Disk containing your C: drive and make note of the disknumber
  • Open Powershell as an Administrator
  • Run the following command
Get-Partition -DiskNumber <disknumber>
  • Make note of partition containing your C: drive and run the following command choose a size that will make the entire disk smaller than an option in Azure
    • Here I'm resizing to 32GB and leaving room for the System Reserved partition on the same disk
Get-Partition -DiskNumber <disknumber> -PartitionNumber <partitionnumber> | Resize-Partition -Size 31GB
  • Edit the variables at the top of the Shrink-VM-OSDisk.ps1 script
    • $DiskID
      • Click on Disks
      • Click on the OS Disk
      • Click on Properties
      • Copy entire Resource ID
    • $VMName
    • $DiskSizeGB
    • $AzSubscription
      • Name of your Azure Subscription
    • $Encrypted
      • $True or $False
      • If $True VM will need to be running and you will be prompted to confirm the removal of the Disk Encryption extension and to disable encryption. After resize you can manually reenable.
  • Make sure you are connected with the Connect-AzAccount command
  • Run Shrink-VM-OSDisk.ps1 script
  • Once complete login to the VM and using Disk Managment extend the C: drive to take up any remaining space.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published