I am newbie in kvm, I used to use xen and I can resize a xen vm in solusvm cp either enlarge nor shrink the size of the disk.
Now in kvm, it seems solusvm cp don't allow me to shrink the disk, and regarding enlarge, there is a new function allow me to add another disk to the vm.
I got 2 questions expect you give me advice below:
1. How to shrink a vm disk if I really need to ?
2. What is the best way to enalrge the total disk spaces ? I figure out there is 2 ways of doing that.
One is to modify the resource in the cp, change the HDD value and then mounted a gparted ISO and rebuild partition.
Another way is to add another virtual disk(s) and make it lvm.
I am asking this because I got a vm running cpanel, I might need to add/remove some disk spaces from time to time.
To increase the size of a KVM VPS in SolusVM, increase the "Hdd Space" in Resources and Reboot the VPS. Use the GParted ISO to increase your VPS's partition as you wish. You can find a detailed how-to with screenshots here: http://wiki.fusioned.net/index.php?title=GParted
Decreasing the size of a KVM VPS in SolusVM is a manual process and I can't stress enough how important it is to a) know what you're doing, b) take backups, and c) take backups again, before doing any of the following.
This is a totally unsupported method - proceed at your own risk.
First boot your VPS with GParted and decrease your partition by ~ 1-2GB less than what you intend to shrink in to. For example if you want to shrink your VPS disk space to 30GB, shrink the partitions in GParted to ~28GB.
Then, log into your node via SSH and execute the following:
lvreduce -L 30G /dev/vps/kvm101_img
(replace with your own correct path to the LV)
Now reboot your VPS and boot into GParted again. This time you should increase the disk space to the exact size of the LV (from 28GB to 30GB in this example). That's it, unmount GParted, and reboot your VPS.
Final step is to update the disk size in SolusVM. For this you have to log into your SolusVM master via SSH and connect to MySQL.
You can find your MySQL credentials by checking out the /usr/local/solusvm/includes/solusvm.conf file.
The format of the solusvm.conf is as follows:
example: <DATABASENAME>:<USER>:<PASSWORD>:<HOST>:<the key is the last entry>
So, if you want to enlarge a kvm hdd space, you will use gparted ISO, I just thinking another way, why not use lvm inside the vm ?
I mean, in solusvm kvm function, there is a function to allow you to add another hdd to the vm, you add it, and then make it lvm, and mount /home to that lvm, next time, if you need enlarge again, just add another hdd and bind it into the lvgroup, then you got enlarged size.
And if you want to shrink, just remove some hdd from the lvgroup, is there any disadvantage of doing this ?