How to increase size of an ubuntu cloud image

4

1

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.

Pensu

Posted 2016-01-05T10:38:13.857

Reputation: 593

Answers

2

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).

Antoine Coetsier

Posted 2016-01-05T10:38:13.857

Reputation: 31

For me it says "Unsupported platform on EFI system, doing nothing". – Serge Rogatch – 2016-11-04T18:00:44.403

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 – 2017-06-06T17:23:20.897

2

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 /.

Ciro Santilli 新疆改造中心法轮功六四事件

Posted 2016-01-05T10:38:13.857

Reputation: 5 621