Adding capacity to 10GB marketplace Ubuntu - KVM image

Hi,

i’m running oneb 4.10.2 with two nodes and nfs storage. I have a VM running the Ubuntu 14.04 - KVM image from the marketplace which has 10GB storage capacity.

Whats my best option to change the capacity? I have successfully attached a second disk (Datablock) but Ubuntu doesn’t recognize it. I would prefer to just expand the OS disk if possible.

Thank you for your help!
~BurbVision

there is no way to resize it using sunstone, as far as I know, so you’d have to use commandline for it.
Here is a good guide (see bottom). Michael Orlitzky { Resizing a KVM or QEMU disk image }

Regarding the datablock; that will give you a raw device, which you cant mount as a qcow2 image, which is probably what the marketplace uses. after creating a datablock, change type in ONE to OS, add to VM and boot it.

cat /proc/partitions

Should show the extra disk now.

Basically, if your marketplace image works with qcow2, check the link for instructions to resize it.
If your current ubuntu image is raw, add an extra datablock as disk or use the same guide, without converting it to qcow2.

EDIT: found another (easier) way, but I havent tried this before:
Increase the qcow2 disk. It a simple command to increase the size of the disk. Here I am adding 5GB to an Ubuntu Server disk.

qemu-img resize ubuntu-server.qcow2 +5GB

source: How to resize a qcow2 harddrive images – Random Hacks / σX

2 Likes

If your Ubuntu Image is in LVM format you could add the new disk to the
template and after add the new disk to the LVM Disks. With this you could
expand the golden images adding new disks to the template.

Thank you both for your responses! Its qcow2. I’ll give your solution a try @VURoland

do i run this command on the VM itself? if so it says qemu-img not found. I probably need to install qemu if thats the case.

hi,
no you need to do that from the virtualization-host, with the VM shut down, so the image is not in use. It should be in /var/lib/one/datastores/0/random-hash/

ah, got it! thank you for the quick reply! Ill let you know how it goes :wink:

BTW - using the command

oneimage list

You can find out what the random-hash is for a certain image-id

1 Like

your the best! thanke!

so that returned “image resized”, and qemu-img info shows "virtual size: 300GB (what i want) and disk size: 12GB but the guest OS ubuntu doesn’t see the free space when using partitionmanager. as it turns out my guest OS disk is LVM. sunstone still shows 10GB size for that vm image.

You must to resize the partitions inside the Virtual Machine. After resize
the qcow image you have some free disk but you must expand the LVM
partitions inside the VM.

Power ON the VM and lvextend, after extended the LVM volume you must to
resize the filesystem inside the VM con resize2fs

lvextend doesn’t recognize any new free space… maybe something is wrong with my qcow resizing? - thanks for all of your help!

For expand a LVM System firstly you must expand PV volumes, after LV
Volumes and finally the VG Group

After all you must resize the filesystem itself.

These are the steps after the qemu resize for the qcow image.