Generic cloud image - how to add storage?

General support questions
Post Reply
GamesBond
Posts: 39
Joined: 2010/04/06 11:36:31

Generic cloud image - how to add storage?

Post by GamesBond » 2016/08/16 20:16:03

I would like to use the generic cloud image as foundation for a LAMP virtual guest.

By default, the root partition is small and will not have enough storage space for files etc.

I never used a cloud image before, how to enlarge the storage space in an image?

Thanks for any hints / tips!

mghe
Posts: 766
Joined: 2015/11/24 12:04:43
Location: Katowice, Poland

Re: Generic cloud image - how to add storage?

Post by mghe » 2016/08/16 21:34:51

First you have resize image of hdd.

qemu-img resize CentOS-7-x86_64-GenericCloud.qcow2 +2GB

And next resize

# fdisk /dev/vda

next: n ; p ; 3 ; enter ; enter ; t ; 3 ; 8e ; w ( new, primary, number of partition, first-last cilinder, change type, number of partition, type 8e [LVM], write )

next restart system:

next:

# pvcreate /dev/vda3

# vgs to display name of group

# vgextend centos /dev/vda3

# lvdisplay to show logical volume path

# lvextend /dev/centos/root /dev/vda3

and finally :

# xfs_growfs /dev/centos/root

and check size of :

# lsblk

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: Generic cloud image - how to add storage?

Post by aks » 2016/08/17 17:35:15

Or just add another disk to the VM and mount it in the appropriate place ....

GamesBond
Posts: 39
Joined: 2010/04/06 11:36:31

Re: Generic cloud image - how to add storage?

Post by GamesBond » 2017/07/02 17:43:44

Project has been stalled for a while, will pick it up again now. Thanks for the reply mhge!

How would a cloud service / server tackle that problem? They have an automated way to grow/deploy the cloud images?

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Generic cloud image - how to add storage?

Post by TrevorH » 2017/07/02 18:16:00

I believe cloud-init is installed and runs on the images and has the ability to auto-resize to the full size of the disk image given.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

vamfoom
Posts: 39
Joined: 2014/05/24 01:28:37

Re: Generic cloud image - how to add storage?

Post by vamfoom » 2018/04/12 23:59:53

The only thing I don't like about the cloud image provided is that it's made of one single partition so if you have run-away logs (in /var/log, for example), it could render the system unusable.

I'm looking at the cloud-init disk_setup module but I don't think it can resize existing images (such as the single partition in the centos cloud image) without losing data. Obviously, we can always attach additional storage but would be nice if that wasn't the case.

Post Reply