Resizing Kolla Vagrant CentOS base box

At the time of this writing Kolla uses the puppetlabs/centos-7.0-64-puppet as the base box for the Vagrant Virtual Box provider. The main issue with the selected base box is that it only has a 20GB root disk. However, Kolla needs at least a 40GB disk when doing a All In One installation.

I ran into the following error when using the default 20GB base box:

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
cat /tmp/vagrant-network-entry_enp0s8 >> /etc/sysconfig/network-scripts/ifcfg-enp0s8
Stdout from the command:
Stderr from the command:
cat: write error: No space left on device

The temporary solution just to get Kolla installed using Vagrant without any further modifications is to resize the puppetlabs/centos-7.0-64-puppet base box to have a larger disk size.

Create Vagrant VM

After cloning the kolla repository, navigate to kolla/dev/vagrant and run vagrant up Then shutdown the VM vagrant halt

Find Disk to be resized

List all VMS VBoxManage list vms

Keep note of the VM name Example: "vagrant_operator_1446740538626_12437" {29db98c9-b085-4ecc-be9b-dba01d8c2256}

Find the VM disk: VBoxManage showvminfo vagrant_operator_1446740538626_12437 | | grep vmdk Example: IDE Controller (0, 0): /Volumes/diogogmtdata/VirtualBox VMs/vagrant_operator_1446740538626_12437/packer-centos-7.0-x86_64-virtualbox-vagrant-puppet-1438003672-disk1.vmdk (UUID: 3ca3b592-784e-4dc2-9e84-af0b63bec83f)

Resize the disk

Convert VMDK disk to VDI: VBoxManage clonehd packer-centos-7.0-x86_64-virtualbox-vagrant-puppet-1438003672-disk1.vmdk vagrant-puppet-disk1.vdi --format vdi

Resize the VDI disk: VBoxManage modifyhd vagrant-puppet-disk1.vdi --resize 61440

Attach resized disk into the VM

Find the storage controller name: VBoxManage showvminfo vagrant_operator_1446740538626_12437 | grep Storage Example: Storage Controller Name (0): IDE Controller

Attach disk into the VM: VBoxManage storageattach vagrant_operator_1446740538626_12437 --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium vagrant-puppet-disk1.vdi

Note: By attaching as device 0 automatically will detach the existing disk

Create new primary partition

Start again the VM: vagrant reload && vagrant ssh

Using fdisk: fdisk /dev/sda

Command: n

  • Partition type: p (primary)
  • Partition number (3,4, default 3): 3
  • Use default value for first and last sectors

Command: t

  • Partition number (1-3, default 3): 3
  • Hex code (type L to list all codes): 8e

Command: w

Reboot VM: reboot

Extend partition

Create physical volume: pvcreate /dev/sda3

Extend volume group: vgextend centos /dev/sda3

Extend partition: lvextend -l +100%FREE /dev/mapper/centos-root

Since CentOS uses XFS as the file system you can’t use resize2fs to resize the partition.

Instead use xfx_growfs: Install xfx_growfs: yum install -y xfsprogs.x86_64 Resize partition: xfs_growfs /dev/mapper/centos-root