7

I have been trying to start a VM using ubuntu cloud images. Now, the image size is very less, I am getting around only 2GB of space. Is there any way to increase the size? I tried qemu-img resize, but it doesn't work, as I am not able to reallocate the space from inside the VM.

TIA.

2 Answers 2

6

I will be talking based on some quick QEMU experiments along the following setup: https://askubuntu.com/questions/281763/is-there-any-prebuilt-qemu-ubuntu-image32bit-online/1081171#1081171

qemu-img

As of 18.04, the cloud images are already in qcow2 format, so the following seemed to work:

qemu-img resize ubuntu-18.04-server-cloudimg-arm64.img +128G

The guest appeared to immediately pick this new size up.

growpart

This script claims to make a given partition fill up as much space as possible and might be of use:

sudo apt-get install cloud-guest-utils
sudo growpart /dev/vda 1

It seems to run happily even though /dev/vda1 was mounted at /.

3

The growroot package is designed to do exactly that. http://packages.ubuntu.com/fr/trusty/admin/cloud-initramfs-growroot

If not already installed, add it with apt-get install cloud-initramfs-growroot and reboot your instance. The root partition will be expanded to the full size of your virtual disk (the one that you extended using qemu-img).

2
  • For me it says "Unsupported platform on EFI system, doing nothing". Nov 4, 2016 at 18:00
  • This seems to be already installed on the Ubuntu 16.04 cloud image. At least it worked for me and I didn't have to do any apt install.
    – AlanObject
    Jun 6, 2017 at 17:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .