Adding Space to iohyve VM Without Breaking Guest OS

Status
Not open for further replies.

nello

Patron
Joined
Dec 30, 2012
Messages
351
This is my current Ubuntu Virtual Machine (VM) running under iohyve:
Code:
[admin@OctoberGroupNAS] /% iohyve info			 
Guest		   Size  CPU  RAM  Pool
ubusrv16		-	 1	6G   red
ubusrv16/disk0  20G   -	-	red
[admin@OctoberGroupNAS] /% 


When I try to upgrade Ubuntu, I'm told that I don't have enough space:
Code:
nello@ubuntu16:~$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree	   
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  apparmor cloud-initramfs-copymods cloud-initramfs-dyn-netconf distro-info-data firefox gir1.2-dbusmenu-glib-0.4 gir1.2-networkmanager-1.0 gnome-calculator gnome-software gnome-software-common grub-legacy-ec2 im-config init init-system-helpers initramfs-tools initramfs-tools-bin initramfs-tools-core isc-dhcp-client isc-dhcp-common kbd klibc-utils language-pack-en libapparmor-perl libapparmor1 libappstream-glib8 libc-bin libc-dev-bin libc6 libc6-dbg libc6-dev libdbusmenu-glib4 libdbusmenu-gtk3-4 libdbusmenu-gtk4 libklibc liblightdm-gobject-1-0 liblxc1 libmysqlclient20 libnm-glib-vpn1 libnm-glib4 libnm-util2 libnm0 libpam-systemd libqt5core5a libqt5dbus5 libqt5gui5 libqt5network5 libqt5opengl5 libqt5printsupport5 libqt5sql5 libqt5sql5-sqlite libqt5test5 libqt5widgets5 libqt5xml5 libsystemd0 libudev1 lightdm linux-firmware locales lxc-common lxcfs lxd lxd-client multiarch-support mysql-common network-manager open-iscsi overlayroot python3-distupgrade python3-update-manager snap-confine snapd systemd systemd-sysv thunderbird thunderbird-gnome-support tzdata ubuntu-core-launcher ubuntu-release-upgrader-core ubuntu-release-upgrader-gtk ubuntu-software udev update-manager update-manager-core vlan xserver-common  xserver-xephyr xserver-xorg-core
87 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 161 MB of archives.
After this operation, 686 kB of additional disk space will be used.
E: You don't have enough free space in /var/cache/apt/archives/.


Yes, I tried sudo apt-get clean

Is there another way to get rid of unnecessary backups or caches?

I'm thinking that I need to increase the disk space for this VM. Does that make sense?

How do I do it? Can I use resize without damaging the VM guest installation? I found this description of resize:
Code:
resize
Resizes a disk. THIS CAN BREAK THINGS ON THE GUEST.
Usage: 'iohyve resize <name> <diskN> <size>' where <name> is
the name of the guest, <diskN> is the disk you would
like to remove from the guest, and <size> is the size
of the virtual block device in '16G' format where the
capital G signifies gigabytes.
See 'iohyve disks' for a list of disks for a guest


What is "'16G' format"?

Code:
admin@OctoberGroupNAS] /% sudo iohyve disks ubusrv16
Listing  disks  for  ubusrv16...
diskN	Size
disk0	20G
[admin@OctoberGroupNAS] /% 
 

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
Yes, you can add another virtual disk and use LVM (only if you setup the VM to use this in the first place):
add Adds a new disk to the guest.

Usage: 'iohyve add <name> <size> [pool]' where <name> is the name of the guest, <size> is the size of the virtual block device in '16G' format where the capital G signifies gigabytes. If pool is specified, the disk gets added on that pool
Or resize:
resize Resizes a disk. THIS CAN BREAK THINGS ON THE GUEST.

Usage: 'iohyve resize <name> <diskN> <size>' where <name> is the name of the guest, <diskN> is the disk you would like to remove from the guest, and <size> is the size of the virtual block device in '16G' format where the capital G signifies gigabytes. See 'iohyve disks' for a list of disks for a guest
https://github.com/pr1ntf/iohyve/blob/master/iohyve.8.txt

If you resize, you then have to fdisk the partition within the VM, delete the partition and re-create it using the same starting sector and ending in the last sector. CAUTION: YOU HAVE TO BE VERY CAREFUL HERE. Do this step wrong, you destroy the VM. Take a snapshot of the zvol before proceeding.

Once you have done that, you can use resize2fs to extend the ext[2/3/4] volume.

Edit: Ubuntu typically puts the swap partition at the end of the disk. You will need to turn swap off (using: swapoff /dev/sda[n]) and then erase the swap volume. When you re-create your partition, make sure you leave enough space for swap.

Once you've done that, you'll need to run blkid and update /etc/fstab.
 
Last edited:

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
I've just found this and tried to use the principles to resize a bhyve ubuntu VM. I found the following useful in terms of some of the steps, which I am blatantly plagiarising below!

WARNING - DO NOT FOLLOW THIS AS ALTHOUGH IT LOOKED TO WORK IT DOESNT

SEE POST BELOW


*** Deleted incorrect steps here ***
 
Last edited:

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
Status
Not open for further replies.
Top