How to change VPS disk size manually

From ISPWiki
Jump to: navigation, search
Hierarchy: VMmanager KVM -> VIRTUAL MACHINES
VMmanager Cloud -> VIRTUAL MACHINES

In VMmanager you can enlarge the VPS disk size.

  • Currently it is not possible to enlarge disk size on the RBD storage
  • for enlarging disk size on File and NFS storages, you need to have libvirt 0.9.10 and later

VMmanager configuration

Enlarging disk size

Browse to the Virtual machines module, select your VPS and click the "Disks" icon

VMresize1.png

Select your disk and click "Edit"

VMresize2.png


Enlarge the disk size. ATTENTION You cannot reduce the disk size

and click "OK"

Please note: set a lower boot priority for booting from the rescue disk

Connecting the rescue disk

SSH access the server and execute the following commands

root@vm:~# cd /nfsshare/iso/
root@vm:~# wget -O rescueFree.iso "ftp://ftp2.ru.freebsd.org/pub/FreeBSD/ISO-IMAGES-amd64/9.2/FreeBSD-9.2-RELEASE-amd64-bootonly.iso"
root@vm:~# wget -O rescue.iso "http://downloads.sourceforge.net/project/systemrescuecd/sysresccd-x86/4.0.0/systemrescuecd-x86-
4.0.0.iso?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fsystemrescuecd%2Ffiles%2Fsysresccd-x86%2F4.0.0%2Fsystemrescuecd-x86-
4.0.0.iso%2Fdownload%3Fuse_mirror%3Dhivelocity&ts=1392711625&use_mirror=citylan"

Or download other iso that you like

In the "Virtual disks" module click "ISO".

  • For linux - rescue.iso
  • For FreeBSD - rescueFree.iso
  • For Windows you do not need to boot from ISO

VMresize4.png

Enlarging disk size on different systems

FreeBSD

Boot from rescueFree.iso - LiveCD FreeBSD. Then select

VMresize5.png

Log in as root and execute (our disk is connected as vtbd0, we need the third section):

gpart recover /dev/vtbd0
gpart resize -i3 /dev/vtbd0
growfs /dev/vtbd0p3

Confirm that you want to enlarge the size. Connect ISO and boot into the system

Linux ext2/ext3/ext4

Boot from rescue.iso. Select the first variant

VMresize6.png

Log in as root and open

fdisk /dev/vda

We need the third action (type in the first letters, see comments after # ):

d # Delete the section (data  won't be deleted)
3 # Section number
n # Create a new section 
p # Primary
3 # Section number 

Fdisk will select the correct first and last section, you will only double-press Enter

w # specify  the new table on the disk 

Run the disk check

e2fsck -f /dev/vda3

Enlarge the FS

resize2fs /dev/vda3

That's all. Disable ISO and reboot

Windows

After you have enlarged the disk size, restart the VPS. Browse to Server Manager -> Disk Management

Right click to select your disk. Make Extend Volume

VMresize7.png

Confirm all the Wizard actons to enlarge the disk space