none
Expand a Managed Data Disk Size after ADE (azure disk encryption) RRS feed

  • Question

  • Hi Team,

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

    1. I have deployed a Linux VM in Azure. example: say OS Disk size 30 GB & Data Disk Size 76 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 Data disks to 128 GB.

    I have added the required size in the Azure VM template. After I started the VM, It is showing in the portal as Disk added, but I could not extend the Volume in the linux 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 ?


    Monday, October 21, 2019 2:33 PM

Answers

  • @Amine KONDI How can I expand the space of a Data disk encrypted with Azure Disk encryption? Refer to the steps mentioned below

    1. Stop the VM from the portal.
    2. Prior to proceed, make sure that has a fresh full backup of the VM or a snapshot of all the disks.
    3. Increase the size of the corresponding data disk from the portal and then restart the VM 

         1. Go to the Disks blade of the corresponding VM in the Azure Portal and click on the corresponding data disk you would like to resize
         2. Click on the Configuration blade under Settings section and modify the size of the disk to the desired size, then click on Save
        3. Back in the Disks blade, you will see the disk has the new size
        4. Restart the VM from the Portal (Overview blade).

         

    4. Once the VM is restarted you can see the disk size increased, but the partition table, the encrypted layer and the file system will not be yet increased 

    1.	You can use the command fdisk -l to verify the current disk size
    # fdisk -l /dev/sdd

    2. Taking a look at the lsblk and df -h commands outputs you can see the file system has not been yet resized. # df -h # lsblk

    5. Use fdisk (if the disk size is under 2TB of size) or parted (if the disk size is over 2TB of size) to increase the size of the partition by deleting it and recreating it with full size and the use the partprobe command to update the kernel about the modified partition. 

     1.	Resize the partition table using fdisk
    
      # fdisk /dev/sdd
       press '''d''' to delete the partition and then hit ''Enter''
       press '''n''' to create the new partition and then hit ''Enter''
       press '''p''' to make it a primary partition and then hit ''Enter''
       press '''1''' and then hit ''Enter''
       press <Enter>
       press <Enter>
       press '''wq''' to save the changes to the partition table and exit fdisk and then hit ''Enter''
    
    2.    Execute partprobe to update the partition table at kernel level
    
        # partprobe
    
    3.   Validate the partition table has been resized using the following command. You can see the partition has the new size reflected but the file system   (the encrypted layer) is still pending to be resized:
    
        # lsblk
    
    4.   Proceed to increase the size of the encrypted layer as well using the following command
    # cryptsetup resize /dev/mapper/2ed*********5d2c
    Note: Replace the device mapper (/dev/mapper/2e**********e5d2c) accordingly
    
    5.   You should now see both the partition table and the encrypted layer with the new size using the lsblk command, it's still pending to resize the file system which you can confirm using the df -h command
    
        # lsblk
        # df -h
       

    Important: In case you don't see the partition table properly resized, go ahead and reboot the Virtual Machine to apply the changes at kernel level   

       6.Proceed to resize the file system using the following command, make sure use the device mapper (encrypted layer) as a parameter for the resize instead of the partition table or device name. You can use the df -h command to validate the file system has the new desired size 

      1. If the file system format is XFS use the following command to resize the file system:
    
        # xfs_growfs /dev/mapper/2ed*************34e5d2c   
        
         2.If the file system format is ext4/ext3 use the following command to resize the file system:
    
        # resize2fs /dev/mapper/2ed21bd8-15f4-4bb3-86bf-bbea134e5d2c
         Important: Replace the corresponding device mapper (/dev/mapper/2ed21bd8-15f4-4bb3-86bf-bbea134e5d2c) accordingly
        
        3.Validate the file system size has been increased using the following command:
    
        # df -h /data
    Hope this helps! 

    Kindly let us know if the above helps or you need further assistance on this issue.
    ------------------------------------------------------------------------------------------
    Do click on "Mark as Answer" and Upvote on the post that helps you, this can be beneficial to other community members.
    Wednesday, October 23, 2019 4:20 PM
    Moderator

All replies

  • @Amine KONDI “When you say you couldn’t extend the Volume in the Linux VM” After the disk is added in the Portal. Are you getting any error message or error code? If, so can you share screenshot of the error?

    To partition, format, and mount your new disk so your Linux VM can use it, SSH into your VM. For more information, see How to use SSH with Linux on Azure. The following example connects to a VM with the public DNS entry of mypublicdns.westus.cloudapp.azure.com with the username azureuser:

    Connect to the Linux VM to mount the new disk.

    You can add a new data disk using az vm disk attach, or through the Azure portal. Before you can encrypt, you need to mount the newly attached data disk first. You must request encryption of the data drive since the drive will be unusable while encryption is in progress.

    There is a similar discussion thread in MSDN forum related Window, I would request you refer to the suggestion mentioned in that thread you will get some idea.


    Tuesday, October 22, 2019 11:42 AM
    Moderator
  • HI,

    this is the steps that I took:

    I have a VM runing Ubuntu, composed of an Os disk (nothing wrrong with it) and a Data disk. I encrypted both of disks with azure disk encryption (I don’t have a problem of accessing the vm or attaching the data disk), now I switched off the vm and I added data disk space from the portal (operation succeeded) I switched on the vm (cool). when I access to the VM session (root) I want to expand the encrypted data disk with the disk space that I added.

    now my question is:

    How can I expand the space of a Data disk encrypted with Azure Disk encryption?


    Tuesday, October 22, 2019 3:53 PM
  • @Amine KONDI How can I expand the space of a Data disk encrypted with Azure Disk encryption? Refer to the steps mentioned below

    1. Stop the VM from the portal.
    2. Prior to proceed, make sure that has a fresh full backup of the VM or a snapshot of all the disks.
    3. Increase the size of the corresponding data disk from the portal and then restart the VM 

         1. Go to the Disks blade of the corresponding VM in the Azure Portal and click on the corresponding data disk you would like to resize
         2. Click on the Configuration blade under Settings section and modify the size of the disk to the desired size, then click on Save
        3. Back in the Disks blade, you will see the disk has the new size
        4. Restart the VM from the Portal (Overview blade).

         

    4. Once the VM is restarted you can see the disk size increased, but the partition table, the encrypted layer and the file system will not be yet increased 

    1.	You can use the command fdisk -l to verify the current disk size
    # fdisk -l /dev/sdd

    2. Taking a look at the lsblk and df -h commands outputs you can see the file system has not been yet resized. # df -h # lsblk

    5. Use fdisk (if the disk size is under 2TB of size) or parted (if the disk size is over 2TB of size) to increase the size of the partition by deleting it and recreating it with full size and the use the partprobe command to update the kernel about the modified partition. 

     1.	Resize the partition table using fdisk
    
      # fdisk /dev/sdd
       press '''d''' to delete the partition and then hit ''Enter''
       press '''n''' to create the new partition and then hit ''Enter''
       press '''p''' to make it a primary partition and then hit ''Enter''
       press '''1''' and then hit ''Enter''
       press <Enter>
       press <Enter>
       press '''wq''' to save the changes to the partition table and exit fdisk and then hit ''Enter''
    
    2.    Execute partprobe to update the partition table at kernel level
    
        # partprobe
    
    3.   Validate the partition table has been resized using the following command. You can see the partition has the new size reflected but the file system   (the encrypted layer) is still pending to be resized:
    
        # lsblk
    
    4.   Proceed to increase the size of the encrypted layer as well using the following command
    # cryptsetup resize /dev/mapper/2ed*********5d2c
    Note: Replace the device mapper (/dev/mapper/2e**********e5d2c) accordingly
    
    5.   You should now see both the partition table and the encrypted layer with the new size using the lsblk command, it's still pending to resize the file system which you can confirm using the df -h command
    
        # lsblk
        # df -h
       

    Important: In case you don't see the partition table properly resized, go ahead and reboot the Virtual Machine to apply the changes at kernel level   

       6.Proceed to resize the file system using the following command, make sure use the device mapper (encrypted layer) as a parameter for the resize instead of the partition table or device name. You can use the df -h command to validate the file system has the new desired size 

      1. If the file system format is XFS use the following command to resize the file system:
    
        # xfs_growfs /dev/mapper/2ed*************34e5d2c   
        
         2.If the file system format is ext4/ext3 use the following command to resize the file system:
    
        # resize2fs /dev/mapper/2ed21bd8-15f4-4bb3-86bf-bbea134e5d2c
         Important: Replace the corresponding device mapper (/dev/mapper/2ed21bd8-15f4-4bb3-86bf-bbea134e5d2c) accordingly
        
        3.Validate the file system size has been increased using the following command:
    
        # df -h /data
    Hope this helps! 

    Kindly let us know if the above helps or you need further assistance on this issue.
    ------------------------------------------------------------------------------------------
    Do click on "Mark as Answer" and Upvote on the post that helps you, this can be beneficial to other community members.
    Wednesday, October 23, 2019 4:20 PM
    Moderator
  •  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.
    Thursday, October 24, 2019 2:01 PM
    Moderator
  • Is there any update on the issue?

    If the suggested answer helped for your issue, do click on "Mark as Answer" and “Vote as Helpful” on the post that helps you, this can be beneficial to other community members.

    Saturday, October 26, 2019 4:13 PM
    Moderator
  • @Amine KONDI Is there any update on the issue?

    If the suggested answer helped for your issue, do click on "Mark as Answer" and “Vote as Helpful” on the post that helps you, this can be beneficial to other community members.

    Sunday, October 27, 2019 2:14 PM
    Moderator
  • @SumanthMarigowda-MSFT

    Thank you for your answer, actually i didn't try it yet, but it ssems logical. once i test and hopping to get good result i will give you a feed back.

    in all cases thak you so much fot your Help

    Monday, October 28, 2019 1:04 PM
  • Following up to see if the above suggestion was helpful. And, if you have any further query do let us know.If the suggested answer helped for your issue, do click on "Mark as Answer" and “Vote as Helpful” on the post that helps you, this can be beneficial to other community members.
    Thursday, October 31, 2019 3:28 PM
    Moderator
  • Is there any update on the issue?

    If the suggested answer helped for your issue, do click on "Mark as Answer" and “Vote as Helpful” on the post that helps you, this can be beneficial to other community members.

    Wednesday, November 6, 2019 5:12 PM
    Moderator
  • Hello @


    I confirme to you that the given solution woks perfectly in some Linux distributions. I appriciate really your hight estimated help and the qualety of your solution.

    to the pleaser of working with you on ather cases on future, please accept my gratitude. 
    Friday, November 8, 2019 9:54 AM
  • Friday, November 8, 2019 12:09 PM
    Moderator