Increase the Size of the Root Partition on a vCSA

Share on:

This is a workaround and might not supported

In my lab the VCSA root partition / residing on /dev/sda3 was running out of space. To fix this I resized the partition using the following steps:

  1. Taking a backup of the appliance using the build in backup function in the VAMI.
  2. Shutting the vCenter Server down.
  3. Log in to the Host or vCenter that manages our test vCenter Server
  4. Edit Settings and increase the size for Hard disk 1
  5. Take a snapshot of the VM, after increasing the hard disk
  6. Open the VMRC to the VM and power the VCSA back on
  7. When seeing the Photon OS GRUB screen. Hit the [E] Key
  8. Add at the end of the line starting with linux the following text rw init=/bin/bash
  9. Hit [F10] or [STR] + [X] to boot into single user mode

Now we need to run the following commands:

To list the current layout of the disk. Use:

  1. fdisk -l /dev/sda

To edit the Partition table on the disk we want to use the following commands:

  1. parted /dev/sda
  2. unit s
  3. p

After confirming that there is no partition after the End of partition 3 we can continue to remove the partition.

  1. rm 3
  2. yes
  3. ignore
  4. p

This should show part 3 missing. Now we can recreate it.

  1. mkpart 3 ext4 2365440 -1

We use 2365440 as the beginning of the next partition as the End of the previous partition was 2365439

  1. yes
  2. p
  3. q

Now we need to resize the filesystem itself.

  1. resize2fs /dev/sda3

And finally let's reset the VM using the web client.