Sunil Agarwal
Sunil Agarwal

Reputation: 4277

Azure : How to expand disk size for VM which is part of scaleset?

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?

Upvotes: -1

Views: 3259

Answers (2)

Neil Sant Gat
Neil Sant Gat

Reputation: 897

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 } ] },

Upvotes: 2

Jason Ye
Jason Ye

Reputation: 13954

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.

Upvotes: 0

Related Questions