Skip to content
Advertisement

How to Expand OS disk on a Linux VM using Cloud Shell?

I have a little problem with a production Classic VM. I reached the maximum capacity of the disk, and I need to expand it.

So I tried:

azure config mode arm

then

azure vm deallocate --resource-group XXX --name XXX

the result:

info:    Executing command vm deallocate
+ Looking up the VM "XXX"
error:   Virtual machine "XXX" not found under the resource group "XXX"
error:   Error information has been recorded to /home/xyz/.azure/azure.err
error:   vm deallocate command failed

I don’t understand why there is no VM in the resource group, so I tried to list what is in the resource group^

azure resource list

and the result:

data:    /subscriptions/xyz/resourceGroups/XXX/providers/Microsoft.ClassicCompute/virtualMachines/XXX                           XXX                         XXX                     Microsoft.ClassicCompute/virtualMachines          westeurope  null

So I have a VM, but Azure can’t see it.

Advertisement

Answer

If you want to deallocate a classic VM, we should use this command azure vm shutdown 'vnmane' in CLI 1.0 with ASM mode:

jason@Azure:~$ azure config mode asm
info:    Executing command config mode
info:    New mode is asm
info:    config mode command OK
jason@Azure:~$ azure vm shutdown -h
help:    Shutdown the VM
help:
help:    Usage: vm shutdown [options] <name>
help:
help:    Options:
help:      -h, --help               output usage information
help:      -v, --verbose            use verbose output
help:      -vv                      more verbose with debug output
help:      --json                   use json output
help:      -d, --dns-name <name>    only show VMs for this DNS name
help:      -p, --stay-provisioned   if specified the compute resource will not be released on shutdown
help:      -s, --subscription <id>  the subscription id
help:
help:    Current Mode: asm (Azure Service Management)
jason@Azure:~$ azure vm shutdown 'jasonv'
info:    Executing command vm shutdown
+ Getting virtual machines
+ Shutting down VM
info:    vm shutdown command OK
jason@Azure:~$

Hope this helps:)

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement