Increase OS and Data Disk Size after ADE RRS feed

  • Question

  • Hi Team,

    I need a help in my Azure environment for the following.

    1. I have deployed a SQL Windows VM in Azure. example: say OS Disk size 128 GB & Data Disk Size 128 GB.

    2. I have enabled the Azure Disk encryption for both the OS & Data Disks.

    3. Now I have a requirement of increasing the disk size of both OS & Data disks to 256 GB.

    I have added the required size in the Azure portal after switching off the VM. After I started the VM, It is showing in the portal as Disk added, but I could not extend the Volume in the disk management inside the windows VM.

    May I know is it the default behaviour  while adding additional disk size to the encrypted disk. Is there any option to increase the size without decrypt, then add more disk and Re-encrypt again ?

    • Edited by nvk31 Tuesday, April 9, 2019 8:57 AM
    Tuesday, April 9, 2019 8:53 AM

All replies

  • @nvk31, Thanks for posting here!

    when you say "could not extend the Volume in the disk management inside the windows VM"

    Are you facing any error? If yes, could you share the screenshot?

    Tuesday, April 9, 2019 9:37 AM
  • Hi Yaswanth,

    Thanks for your quick reply. Actually I am trying to add 256 Gb disk to the existing 256 GB.  In the Disk Management console, I am not seeing the option to "Extend Volume" enabled when I Right click the Disk to extend the size. I am unable to insert a screenshot for the same.

    But I get the "Extend Volume"option enabled when I Right click the C: Volume under the Server Manager > File and storage Services > Volumes. But the status has changed to Extend failed as soon as I click that option.
    • Edited by nvk31 Tuesday, April 9, 2019 10:05 AM
    Tuesday, April 9, 2019 9:56 AM
  • You can expedite verification by replying to this thread with your request to verify your account - https://social.technet.microsoft.com/Forums/en-US/090972cb-b81f-498f-b718-948caca975c4/verify-account-41?forum=reportabug

    Let us know once your account is verified.You can able to post the screen shot of the error to help better on this issue.

    Tuesday, April 9, 2019 10:34 AM
  • Hi Yashwanth,

    I have replied to the thread "Verify account 42" to verify my account as I didn't get a reply option in the link you have sent.

    Thanks & Regards,

    Tuesday, April 9, 2019 11:02 AM
  • Hi Yashwanth,

    Replied to the above link.

    Thanks & Regards,

    Tuesday, April 9, 2019 11:47 AM
  • @nkk31, I reproduced your issue at my end and i'm able to extend the size for OS disk and Data disk in windows VM. I have followed the below steps.

     Created a Windows vm with 128GB of OS disk and 128GB of Data Disk as shown below.

    Intialized the data disk, before encrypting the data disk.

    Encrypted the windows VM

    After encrypting, i have resized the OS and DATA disk size to 256GB using below power shell script

    Connect-AzAccount Select-AzSubscription –SubscriptionName 'Your subscription name' $rgName = 'your resource group name' $vmName = 'your virtual machine name' $vm = Get-AzVM -ResourceGroupName $rgName -Name $vmName Stop-AzVM -ResourceGroupName $rgName -Name $vmName $disk= Get-AzDisk -ResourceGroupName $rgName -DiskName $vm.StorageProfile.OsDisk.Name $disk.DiskSizeGB = 256 $disk= Get-AzDisk -ResourceGroupName $rgName -DiskName $vm.StorageProfile.DataDisks[0].Name $disk.DiskSizeGB = 256 Update-AzDisk -ResourceGroupName $rgName -Disk $disk -DiskName $disk.Name

    Start-AzVM -ResourceGroupName $rgName -Name $vmName


    RDP to VM and open Disk Management and right-click on OS drive, Data drive and select “Extend Volume…” to expand OS drive to new size.

    Kindly, let us know if you need any further help on this.

    Tuesday, April 9, 2019 1:07 PM
  • Hi Yashwanth,

    Thanks for your detailed steps. We have done same disk extension manually in portal and the same is reflecting in the portal and showing in the Disk management as online, but it is not showing the "Extend volume" as enabled.


    Tuesday, April 9, 2019 1:46 PM
  • Would it be possible to attempt the following steps to check if they work:

    1. Open an RDP connection to your VM.

    2. Open a command prompt and type diskpart.

    3. At the DISKPART prompt, type list volume. Make note of the volume you want to extend.

    4. At the DISKPART prompt, type select volume <volumenumber>. This selects the volume volumenumber that you want to extend into contiguous, empty space on the same disk.

    5. At the DISKPART prompt, type extend [size=<size>]. This extends the selected volume by size in megabytes (MB).

    Source: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/expand-os-disk 

    Could you also provide us with the Disk series used on this VM as well as the VM type ?

    Let me know if the above steps don't work for you.

    Tuesday, April 9, 2019 5:22 PM
  • @nvk, any update on this?

    Kindly, let us know if you need any help on this query

    Wednesday, April 10, 2019 10:19 AM
  • Hi,

    As Adam suggested, I have already tried the diskpart option, hereby attaching the snapshot for the same ended up with the below error. Is that something to do with the system Reserved partition(350Mb) in the Disk0 which is in between C: and the unallocated space and not allowing the extension of the volume c: ?

    (As the disk part error says "There is not enough space for this operation"), Is that considering the 350Mb system Reserved as the available space for extension instead of the unallocated space ?

    because, when I read from Yaswanth's snapshot and see the System Reserved space in the first slot, and the Volume C: as second and the unallocated space as the third one..which is allowing to extend the volume c: correctly ?

    I mean the unallocated space is immediately available next to c: for extension which is not in my case..


    Thursday, April 11, 2019 12:52 PM
  • correct me if i'm wrong, but from the screen shot, it looks like you have 256GB that's not allocated in Disk 0, which would equate roughly to 255000 , but you used 262146MB = 262.146GB, could you test to check if: 255000 works ?

    Let me know if this works.
    Thursday, April 11, 2019 9:13 PM
  • @nvk31 Just checking in to see if the above answer helped. If this answers your query, do click “Mark as Answer” and Up-Vote for the same, which might be beneficial to other 
    Monday, April 15, 2019 2:30 AM
  • Hi Adam,

    Thanks for your inputs. I could not make any changes in past days because the VM is being used for some tasks. Now I have tested as you suggested. Still getting the same message. Pls suggest, 

    DISKPART> select volume 0

    Volume 0 is the selected volume.

    DISKPART> extend size=255000

    Virtual Disk Service error:
    There is not enough usable space for this operation.


    Also If anything to do with the position of the System Reserved partition in the Volume 0 as I have mentioned earlier. Correct me if I am wrong.


    Wednesday, April 17, 2019 7:05 AM
  • @ nvk31 Apologies for the delay!  If you are disk manager looks like the below image. It's not possible to increase their OS disk space because the reserved partition (550mb) is after the OS partition. This is typical behavior of encrypted VM's because during encryption the OS partition is split to create a system partition. It's not possible to remove/move the system partition. With encryption we always stress to make sure your VM is of adequate size and specs prior to encryption.


    The recommended steps are:

    1. Deploy a new VM
    2. Expand OS Disk
    3. Encrypt the disk

      Kindly let us know if the above helps or you need further assistance on this issue.


      Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.

    Monday, April 22, 2019 5:04 AM
  • nvk31 Just checking in to see if the above answer helped. If this answers your query, do click “Mark as Answer” and Up-Vote for the same, which might be beneficial to other community members reading this thread. And, if you have any further query do let us know.
    Wednesday, April 24, 2019 4:54 AM
  • "Deploy a new VM" isn't really desirable. I understand it's more or less necessary in the above case, but are new VMs installed from azure marketplace images still affected by this issue of becoming unable to extend the OS volumes after enabling Azure Disk Encryption? If the System Reserved Partition exists before ADE is enabled from the start, this shouldn't occur, correct?

    Has this been fixed in the VM images, or are there still images affected?

    Thursday, August 8, 2019 3:17 PM
  • @Count.Zer0 Can you also provide more information, what exactly are you trying to accomplish?

    Monday, August 12, 2019 7:54 AM
  • Extend an OS partition on a system where ADE is already enabled. My question is if we would still run into the problem of the system reserved partition being put AFTER the OS partition when enabling ADE making it impossible to to extend the OS partition (and therefore having to rebuild the VM, reinstall applications etc.) OR if this is fixed in current Windows VM images in Azure and no longer an issue with new VMs.
    Tuesday, August 20, 2019 11:22 AM
  • I've managed to perform this successfully, but had to decrypt the VM completely first.  Try this at your own risk and a test VM first.

    I've tested this today on a Windows 2012 R2 VM in Azure with un-managed disks that are already encrypted:

    1. Decrypt  all drives attached to the VM
    2. Create a volume of at least 350Mb at the end of the disk
    3. Enable the new volume to boot Windows – active and BCD entries
    4. Reboot
    5. Delete the old boot volume and expand C:
    6. Re-encrypt the VM

    Here's the detail:

    Check the previous backup snapshot in the portal is successful & available.  Abort if it’s not available.

    Decrypt the VM:
    Disable-AzVMDiskEncryption -ResourceGroupName YOURRESOURCEGROUP -VMName YourVMname -VolumeType all

    Verify when its complete using manage-bde:
    C:\Windows\system32>manage-bde -status

    Create a volume of at least 350Mb at the end of the disk.
    By default you cannot create a partition in the middle of free space, so we must create a ‘spacer’ partition that leaves enough space for the final partition.  
    Additionally, when creating the fourth partition on a disk by default an extended partition will be created and a logical partition inside that so we have to force the creation of a primary partition using diskpart. 
    Using diskmgmt.msc will allow you to calculate the spacer volume accurately.  
    Create a volume in disk 0 with disk manager and copy the space value in Mb available from the create volume dialog box.
    Take 360Mb from this value to get the size of the spacer volume in Mb.
    Finish creating the spacer volume with the calculated size.
    Don’t format the volume.
    Don’t mount the volume.
    Close Disk management & open an elevated command prompt.
    Modify your disk and volume references accordingly:
    Create a new volume at the end of the disk of 360MB.  Mount it at (say) G: and format as NTFS.
    Force primary partition to the end of the disk by:

    sel disk 0
    create partition primary size=350
    sel vol 5

    Copy the system boot details to G:
    Bcdboot.exe c:\Windows /s G:

    The VM starts by using G: as the bootloader 
    Windows kernel opens C: and boots from C:\Windows

    Delete the old 350MB boot partition and the spacer partition
    Expand C: to consume all of the disk
    Remove G: as the drive letter mapping to the boot volume.

    Re-enable encryption using Azure powershell
    $VMName = "YourVMname"
    $AADClientID = "YourClientID"
    $AADClientSecret = 'YourClientSecret'
    $KeyVault = Get-AzKeyVault -VaultName $VaultName -ResourceGroupName $RGName
    $DiskEncryptionKeyVaultUrl = $KeyVault.VaultUri
    $KeyVaultResourceId = $KeyVault.ResourceId
    $VolumeType = "All"
    Set-AzVMDiskEncryptionExtension ` 
        -ResourceGroupName $RGName ` 
        -VMName $VMName ` 
        -AadClientID $AADClientID ` 
        -AadClientSecret $AADClientSecret ` 
        -DiskEncryptionKeyVaultUrl $DiskEncryptionKeyVaultUrl ` 
        -DiskEncryptionKeyVaultId $KeyVaultResourceId ` 
        -VolumeType $VolumeType

    Verify with manage-bde that the disks get encrypted to 100%
    manage-bde -status

    Tuesday, August 27, 2019 5:19 PM