The "cloudmin modify-limits --host somehost --disk 10000" is not supported

I am trying to use "cloudmin modify-limits" command as described on https://www.virtualmin.com/documentation/cloudmin/devel/cli/modify_limits, which lists "[--disk MB | --no-disk]" as an option.

However, if I fire up

cloudmin modify-limits --host somehost --disk 10000

then it gives:

Setting disk limit on KVM system somehost to 9.77 GB ..
.. not supported

and never modifies the volume even after guest reboot. Is this feature supported at all or not yet?

Status: 
Closed (fixed)

Comments

That API command can't be used for KVM and Xen instances, as they don't have a single disk space limit (unlike OpenVZ and LXC).

Instead you need to resize the VM's primary virtual disk with a command like :

cloudmin modify-disk --host somehost --virt /dev/sda --new-size 10000

Note that this can only be done when the VM is shut down.

Hi Jamie,

Thanks for pointing to another command, but it is giving the following error:

cloudmin modify-disk --host somehost.com --virt /dev/vda --new-size 15000
Modifying virtual disk for /dev/vda ..
.. failed : Failed to un-mount /dev/vda1 : umount: /: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

Does this mean first I need to shutdown the guest system?

You need to shut down the VM first - a resize isn't possible on a running system's primary disk.

Got it. Thanks!

The only issue left with this is to pass the correct for sure path to the primary disk. In your example it goes like "/dev/sda" and in my case it was "/dev/vda". I just would like to write a script for all the posterity cases, so would be nice to check the path to primary disk first and then pass to the script. However, the

cloudmin list-systems --host somehost --multiline | grep disk

gives only:

    KVM total disk size: 21.03 GB
    KVM disk driver: VirtIO

How can I know for sure what is the path to primary disk to then pass it to the script?

EDIT: I've just found out I needed to run "cloudmin list-disks --host" command. Now it is getting more complex as instead of one single command to modify size of disk we need to run several, but it does work and that is the most important. However would be nice if a single cloudmin command could perform:

  1. Shutdown the system;
  2. Get the right path to primary disk;
  3. Modify the size of it;
  4. Start up the system.

Another option is to use the --mount flag instead of --virt to identify the disk. Assuming you are resizing the primary disk, you can just use --mount /

Turns out --moun flag works good when expanding the LVM disk, however when shrinking it gives the error, that is discussed on http://serverfault.com/questions/433275/lvm-logical-volume-partition-cor...

They recommend to follow these steps:

When shrinking, you should perform actions in this order: Resize the file system, Resize the logical volume

When growing, you should perform actions in this order: Resize the logical volume, Resize the file system

What would be the most correct Cloudmin command to shrink a disk in this situation?

That's odd, Cloudmin should be able to shrink disks.

Can you post the full error message that you are seeing on your system?

I've already deleted and re-created the system. I'll try this again tomorrow and post the full error message.

I couldn't re-create the issue, so probably the last time was just an incidental error. Marking this as closed.