简体   繁体   中英

Expand Azure Virtual Machine Scale set (VMSS) data disks

I have a VM with 2 virtual machine scale set. There's a requirement to expand the datadisk. I have successfully expanded the VM's datadisk (attached disk). After which I am trying to expand the size of scale set data disks but with failure.

This is what I have done to expand the VM attached disk:

az disk update --resource-group e4s --name e4s-vm-0_disk2_a3d99285cfbc4f0987c8a9c8e4c1f7ef --size-gb 130

ssh to the instance and executed:

sudo mdadm --assemble --update=devicesize /dev/md0 /dev/sdc
sudo mount /dev/md0 /mnt/data
sudo xfs_growfs /mnt/data

After which df -h had shown the expanded size correctly.

For the VMSS, this is what I have done:

az vmss update -n e4s-ss -g e4s --set virtualMachineProfile.storageProfile.dataDisks[0].diskSizeGb=130

Checked the scale set model:

az disk update --resource-group e4s -n e4s-vm-0_disk2_a3d99285cfbc4f0987c8a9c8e4c1f8ef --size-gb 130

[
  {
    "caching": "None",
    "createOption": "empty",
    "diskSizeGb": 130,
    "lun": 0,
    "managedDisk": {
      "storageAccountType": "Premium_LRS"
    },
    "name": null
  }
]

In portal also it's showing the size as 130 在此处输入图片说明 Updated the sc

Since the upgrade policy is manual so updated it:

az vmss update-instances -n e4s-ss -g e4s --instance-ids 1
az vmss update-instances -n e4s-ss -g e4s --instance-ids 2

在此处输入图片说明

After ssh connection to one of the vmss executed the same commands which were executed after expanding the VM disk. But the newly expanded size is not being displayed.

After doing the first step: az vmss update -n e4s-ss -g e4s --set virtualMachineProfile.storageProfile.dataDisks[0].diskSizeGb=130

Did go back to the Azure Portal, click on instances, select the instances and click on upgrade??

I did that and it work for me.

Not sure about the mdadm never used used it but have used article below to successfully resize a data disk.

https://docs.microsoft.com/en-us/azure/virtual-machines/linux/expand-disks#expand-a-disk-partition-and-filesystem

Try it and see if it works for you.

Whatever procedure I have followed is correct. Instead of stopping the vmss they have to be deallocated and started again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM