VM main disk

The main disk always has a size that corresponds to the flavors “Disk” parameters (example: 10GB for flavor m1.small). This size is used to generate the block device in which the image is copied. The image, however, is partitioned from generation and the partitions created do not correspond to the size actually available in the instance. To gain access to the entire instantiated disk, it is necessary to assign the available space to a disk partition.

Note

These manipulations are not necessary if the image contains only one partition and the cloud-init is configured to repartition the VM disk on the fly (action resizefs).

Example with an image whose last partition (2) is used via LVM:

# repartitioning
% fdisk /dev/vda <<EOF
d
2
n
p
2


w
EOF

# a reboot is then necessary for Linux to take this change into account
% shutdown -r now

# integration by LVM
% pvresize /dev/vda2

# the disk space is now available in the volume group provided by vda2