Submitted by yngens on Wed, 08/27/2014 - 13:55
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
Submitted by JamieCameron on Wed, 08/27/2014 - 17:44 Comment #1
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.
Submitted by yngens on Wed, 08/27/2014 - 21:02 Comment #2
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?
Submitted by JamieCameron on Wed, 08/27/2014 - 21:28 Comment #3
You need to shut down the VM first - a resize isn't possible on a running system's primary disk.
Submitted by yngens on Wed, 08/27/2014 - 22:26 Comment #4
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:
Submitted by JamieCameron on Wed, 08/27/2014 - 22:55 Comment #5
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 /
Submitted by yngens on Wed, 08/27/2014 - 23:20 Comment #6
Much better! Thank you!
Submitted by yngens on Thu, 08/28/2014 - 21:28 Comment #7
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?
Submitted by JamieCameron on Fri, 08/29/2014 - 00:18 Comment #8
That's odd, Cloudmin should be able to shrink disks.
Can you post the full error message that you are seeing on your system?
Submitted by yngens on Fri, 08/29/2014 - 02:20 Comment #9
I've already deleted and re-created the system. I'll try this again tomorrow and post the full error message.
Submitted by JamieCameron on Fri, 08/29/2014 - 11:31 Comment #10
Ok, thanks.
Submitted by yngens on Thu, 09/04/2014 - 16:30 Comment #11
I couldn't re-create the issue, so probably the last time was just an incidental error. Marking this as closed.