Ask Your Question

LouisinLondon's profile - activity

2016-03-14 10:46:56 -0500 received badge  Editor (source)
2016-03-14 10:41:59 -0500 received badge  Famous Question (source)
2016-03-14 10:41:46 -0500 answered a question Help resizing bootstack VM kvm which is 100% full

OK. I figured it out in Sept 2015 but forgot to add the solution here... Today we had to do it again and with the help of the Canonical support my memory was jogged. Here's the solution to resizing VMs running under Virsh using LVM's on the Hypervisor..

Firstly increase the Logical Volume: (in this case we are trying to resize the controller VM

sudo lvextend --size +10G /dev/system/controller

After it has resized the LVM to make space for a larger VM disk, we need to use "virt-" commands to rename the current disk to .backup, make new vm disks, and basically copy and expand the data from the old disks onto the new disks.

You can do a

man virt-resize

before you begin.

TO DO : Increase Controller from 10Gb to 20Gb
=====================
virsh shutdown controller
sudo virt-filesystems --long --parts --blkdevs -h -a /dev/system/controller 
sudo lvrename /dev/system/controller /dev/system/controller.backup
sudo lvcreate system -n controller -L 20GB 
sudo virt-resize /dev/system/controller.backup /dev/system/controller --expand /dev/vda1

Then after that

virsh start controller

@hypervisor: ssh maas

from maas

ssh controller

df -h to make sure the controller VM (or whichever VM you were increasing it's size did get it's Filesystem resized)

Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        20G  8.5G   11G  46% /

Then when you are happy your Openstack is working again Remove the Temporary backups of the FileSystems you made

sudo lvremove /dev/system/controller.backup
2015-09-24 09:53:52 -0500 received badge  Notable Question (source)
2015-09-24 09:43:23 -0500 answered a question Help resizing bootstack VM kvm which is 100% full

NOT the answer but an update:

I read up about virsh blockresize and tried on the VM... http://serverfault.com/questions/604876/online-resizing-of-kvm-guest-root-filesystem (http://serverfault.com/questions/6048...)

@hypervisor:~$ sudo virsh blockresize bootstrap --path /dev/system/bootstrap --size 20G error: Failed to resize block device '/dev/system/bootstrap' error: Requested operation is not valid: domain is not running

PS: this also has the wrong path for the file... /dev/system/bootstrap

so a) sudo virsh start bootstrap b) find the path using ps -faux | grep bootstrap which will show file=/dev/mapper/system-bootstrap

Then:

@hypervisor:~$ sudo virsh blockresize bootstrap --path /dev/mapper/system-bootstrap --size 20G Block device '/dev/mapper/system-bootstrap' is resized

except it doesn't seem to make any difference:

Using fdisk shows (I think similarly to previously after the first lvextend that there is now 21.5Gb hdd avail..) but the OS just wont resize... at this point I wish there was just a way to boot the VM using "gparted live" and resize...

@bootstrap:~$ sudo fdisk -l

Disk /dev/vda: 21.5 GB, 21474836480 bytes 16 heads, 63 sectors/track, 41610 cylinders, total 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000

Device Boot Start End Blocks Id System /dev/vda1 * 2048 20971519 10484736 83 Linux

2015-09-24 09:14:52 -0500 commented question Help resizing bootstack VM kvm which is 100% full

I've also tried growing the filesystem from the Hypervisor: @hypervisor:~$ sudo resize2fs /dev/system/bootstrap resize2fs 1.42.9 (4-Feb-2014) resize2fs: Bad magic number in super-block while trying to open /dev/system/bootstrap Couldn't find valid filesystem superblock.

2015-09-24 09:14:20 -0500 commented question Help resizing bootstack VM kvm which is 100% full

Thanks Bernd. Yeah openstack is a beast (powerful but a beast)

I've tried resizefs inside the bootstrap VM and no luck.

  1. @bootstrap:~$ sudo resize2fs /dev/vda1 resize2fs 1.42.9 (4-Feb-2014) The filesystem is already 2621184 blocks long. Nothing to do!
2015-09-24 06:15:39 -0500 received badge  Popular Question (source)
2015-09-22 12:37:05 -0500 asked a question Help resizing bootstack VM kvm which is 100% full

Hi

Background:

I have inherrited sole ownership of an 14 node openstack which was setup via Canonical "jumpstart" which was working fine for the mostpart but is now broken completely..

cant juju or anything

Error / warning:

@maas:~$ juju status
WARNING ignoring invalid API endpoint environment UUID

but can luckily still ssh to VMs from maas, and ssh to other VMs that are part of the infrastructure from there.

Problem:

bootstack vm on the main hypervisor is at 100% disk usage.

@bootstrap:/home$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1       9.8G  9.8G     0 100% /

What I've done: ps –faux | grep bootstrap -> shows the drive file is under /dev/mapper/system-bootstrap

and

@hypervisor:~$ ls -ahlti /dev/mapper

total 0
1440 lrwxrwxrwx  1 root root       8 Sep 22 15:50 system-bootstrap -> ../dm-11

I've done a extention of the lvm

@hypervisor:
sudo lvextend --size +10G /dev/system/bootstrap
  Extending logical volume bootstrap to 20.00 GiB
  Logical volume bootstrap successfully resized

but I'm not very use to openstack style virtualization (mostly work with VSphere )

PS: We're getting a Canonical support contract in place but that might take ages and researchers want the data out of some VMs which were happily working even though the dashboard was inaccessible.

Confusion:

I know that after resizing the LVM partitions would then usually need to be resized but super confused with the way this was setup...

hypervisor:~$ ls -ahlti /dev/mapper | grep bootstrap
1440 lrwxrwxrwx  1 root root       8 Sep 22 15:50 system-bootstrap -> ../dm-11

@hypervisor:~$ ls -ahlti /dev/ | grep dm-11
 9267 brw-rw----  1 libvirt-qemu kvm     252,  11 Sep 22 17:13 dm-11

Question:

Can I just do a

virsh shutdown bootstrap

and then resize using qemu-img ?

http://serverfault.com/questions/324281/how-do-you-increase-a-kvm-guests-disk-space

1.  stop the VM 
2.  run qemu-img resize vmdisk.img +10G to increase image size by 10Gb
3.  start the VM, resize the partitions and LVM structure within it normally

Help *sigh