-1

Am new to Azure and am stuck with one scenario.

I have an env. which consists of multiple scaleset and each scaleset has min. 2-3 instance. Each instance is built up with 2 partitions/drive each of 50 GB disk. Disks are managed disk.

Now

/dev/sdd 50G 45G 5G 90% /data/zk

/dev/sdc 50G 25G 25G 50% /data/kafka

After certain point, disk size reaches 90% and we have to increase disk size. So for 1 of the partition i need to increase disk size by say 100 GB.

So expected output should be something like (after increasing disk size for zk by 100 GB)

Expected

/dev/sdd 150G 45G 105G 30% /data/zk

/dev/sdc 50G 25G 25G 50% /data/kafka

I did some research online but didn't find way to expand disk size.

Has someone done this before?

Sunil Agarwal
  • 4,097
  • 5
  • 44
  • 80
  • Were you able to expand it? I am also trying to do the same but with no success. – devd Mar 19 '19 at 06:19
  • 1
    in Azure we have to detach the disk & then expand disk & then attach the disk back. The approach by Azure is horrible. If you have AWS, please use AWS. In AWS you can expand disk without having any downtime. – Sunil Agarwal Mar 20 '19 at 10:45
  • I have already done it in AWS. In Azure once the disk is detached from the virtual machine scale set, where can it be found? – devd Mar 20 '19 at 11:06

2 Answers2

2

The general process would be to do a PUT on the scale set model (described here: https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-upgrade-scale-set), in particular on the "diskSizeGb" property in the data disk definition:

"storageProfile": { "imageReference": { "sku": "2016-Datacenter", "publisher": "MicrosoftWindowsServer", "version": "latest", "offer": "WindowsServer" }, "osDisk": { "caching": "ReadWrite", "managedDisk": { "storageAccountType": "Standard_LRS" }, "createOption": "FromImage" }, "dataDisks": [ { "diskSizeGB": 1023, "createOption": "Empty", "lun": 0 }, { "diskSizeGB": 1023, "createOption": "Empty", "lun": 1 } ] },

Neil Sant Gat
  • 857
  • 6
  • 10
  • I am also trying to do the same on Linux VM Scale Set. I have updated the `diskSizeGB`: `az vmss update -n e4s-ss -g e4s --set virtualMachineProfile.storageProfile.dataDisks[0].diskSizeGb=130` After that I have updated the scale set Latest Model also `az vmss update-instances -n e4s-ss -g e4s --instance-ids 1` .. `az vmss update-instances -n e4s-ss -g e4s --instance-ids 2` But I am unable to see the size when I do `df -h`. I've expanded VM disk also and on which I am able to view the new expanded size. – devd Mar 19 '19 at 06:46
  • this suggestion worked for me. Note that as recommended the VM instances need to be deallocated -before- the change is made, otherwise the instances fail if you try and deallocated afterwards – ossentoo Jun 04 '19 at 08:37
  • 3
    For anyone else finding this but looking for changes to the OS disk, this approach does not work – volvox Oct 18 '19 at 10:28
0

Based on my knowledge, maybe you can detach managed disk from vmss, then use Azure portal to expand data disk size, then attach managed disk to that VMSS instance, then use shell to mount and expand it in system.

C:\Users\jasony>az vmss disk attach -h

Command
    az vmss disk attach: Attach managed data disks to a scale set or its instances.

Arguments
    --caching          : Disk caching policy.  Allowed values: None, ReadOnly, ReadWrite.
    --disk             : Existing disk name or ID to attach or detach from VM instances.
    --lun              : 0-based logical unit number (LUN). Max value depends on the Virtual Machine
                         instance size.
    --size-gb -z       : Size in GB.

Resource Id Arguments
    --ids              : One or more resource IDs (space-delimited). If provided, no other 'Resource
                         Id' arguments should be specified.
    --instance-id      : Scale set VM instance id.
    --name -n          : Scale set name. You can configure the default using `az configure
                         --defaults vmss=<name>`.
    --resource-group -g: Name of resource group. You can configure the default group using `az
                         configure --defaults group=<name>`.

Global Arguments
    --debug            : Increase logging verbosity to show all debug logs.
    --help -h          : Show this help message and exit.
    --output -o        : Output format.  Allowed values: json, jsonc, table, tsv.  Default: json.
    --query            : JMESPath query string. See http://jmespath.org/ for more information and
                         examples.
    --verbose          : Increase logging verbosity. Use --debug for full debug logs.

Note: You should remember which disk attach to which VMSS instance.

Jason Ye
  • 13,710
  • 2
  • 16
  • 25
  • 2
    if you detach the disk, your application/data is down for that time. What I was looking was same like how easily AWS has implemented the logic. you can increase disk size on the fly without having any downtime. Checked with Azure support, they dont have this feature. anyways thanks for the help. – Sunil Agarwal Mar 20 '19 at 09:36
  • I think the Azure mentality regarding scalesets is that one should apply the modified template first (where the new disk size will only effect new instances), then initiate one or more new instances, and when they are up and running, scale down so the old instances are removed. – j5423951 Sep 26 '20 at 21:07