Increasing the Size of a VCSA Root Filesystem

November 23, 2014 Brian Cunnie

In this blog post we describe the procedure to increase the size of the root filesystem of a VCSA (VMware vCenter Server Appliance). This is not normally needed and is only necessary when there is uncommon storage pressure on the VCSA’s root filesystem, e.g. as in the case of the backup procedure described here.

In this example, we increase the size of our vCenter’s (vcenter.cf.nono.com) root partition that is hosted on esxi.cf.nono.com from 25GB to 125GB.

0. Increase the Size of the VCSA’s .vmdk

  • browse to the vCenter: https://vcenter.cf.nono.com:9443/vsphere-client/
  • log in as root
  • Hosts and Clusters → esxi.cf.nono.com → Related Objects → Virtual Machines
  • click VMware vCenter Server Appliance
  • Summary → Edit Settings
    • Hard Disk 1: 125 GB
    • click OK
We save our credentials. If we lose them, we will be unable to backup to S3, we will need to delete the user and create a new one with the same permissions (admittedly not a burdensome task, but one that's easily avoidable).

We increase the size of our disk from 25GB to 125GB. The VM does not need to be powered down to increase the disk; however, we will need to reboot the VM so that it picks up the larger disk size.

We were kicked out of our vCenter browser session when we clicked OK, but we logged back in and confirmed that the VCSA disk was the newer 125GB size.

1. Increase the Size of the Root Partition

  • ssh in as root
ssh root@vcenter.cf.nono.com
VMware vCenter Server Appliance
root@vcenter.cf.nono.com's password:
Last login: Thu Nov 20 03:55:23 2014 from 10.9.9.30
vcenter:~ #
  • confirm that the size of the disk on which the root filesystem resides is the original size (26.8GB not 125GB):
fdisk -l /dev/sda

Disk /dev/sda: 26.8 GB, 26843545600 bytes
...
  • reboot
sudo shutdown -r now
  • ssh in after reboot
ssh root@vcenter.cf.nono.com
  • determine the partition on which the root filesystem resides by using df
df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3       9.8G  3.7G  5.7G  40% /
...
  • we see that the root filesystem resides on /dev/sda3

  • confirm the disk is now the correct size (134.2GB). Also, save the partition information of the root filesystem—we will destroy and re-create the root partition, and we need to make sure we use the correct parameters:

fdisk -l /dev/sda

Disk /dev/sda: 134.2 GB, 134217728000 bytes
255 heads, 63 sectors/track, 16317 cylinders, total 262144000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ad6cf

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048      272383      135168   83  Linux
/dev/sda2          272384    31743999    15735808   82  Linux swap / Solaris
/dev/sda3   *    31744000    52428799    10342400   83  Linux
  • The next step is dangerous; if we make a mistake or are unsure of anything, we hit ctrl-C and start over. We use fdisk to delete and re-create the root filesystem’s partition, but with a much larger size. First we delete:
fdisk /dev/sda

Command (m for help): d
Partition number (1-4): 3
  • now we re-create. The defaults do the right thing; we don’t need to override them:
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4, default 3): 3
First sector (31744000-262143999, default 31744000):
Using default value 31744000
Last sector, +sectors or +size{K,M,G} (31744000-262143999, default 262143999):
Using default value 262143999
  • we next set the newly-recreated partition bootable. This is an important step: if we skip it, our VCSA will not boot!
Command (m for help): a
Partition number (1-4): 3
  • we print the partition table a final time; we make sure that the third partition has a ‘*’ in the Boot column:
Command (m for help): p

Disk /dev/sda: 134.2 GB, 134217728000 bytes
255 heads, 63 sectors/track, 16317 cylinders, total 262144000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ad6cf

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048      272383      135168   83  Linux
/dev/sda2          272384    31743999    15735808   82  Linux swap / Solaris
/dev/sda3   *    31744000   262143999   115200000   83  Linux
  • save and quit:
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
  • reboot to make the new partition table take effect
sudo shutdown -r now

2. Resize the Filesystem

  • ssh in as root and resize the filesystem using resize2fs:
ssh root@vcenter.cf.nono.com
VMware vCenter Server Appliance
root@vcenter.cf.nono.com's password:
Last login: Thu Nov 20 04:01:49 UTC 2014 from 10.9.9.30 on pts/1
Last login: Thu Nov 20 04:33:14 2014 from 10.9.9.30
vcenter:~ # resize2fs /dev/sda3
resize2fs 1.41.9 (22-Aug-2009)
Filesystem at /dev/sda3 is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 7
Performing an on-line resize of /dev/sda3 to 28800000 (4k) blocks.
The filesystem on /dev/sda3 is now 28800000 blocks long.
  • use df to check the new size:
df -h /dev/sda3
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3       109G  3.7G  100G   4% /

References

VMware has a related KB article which describes how to increase the size of the database filesystem (/storage/db).

Christian Stankowic has a blog post that describes migrating the database portions to LVM.

About the Author

Biography

More Content by Brian Cunnie
Previous
Data Science Case Study: A Healthcare Company's Journey To Big Data
Data Science Case Study: A Healthcare Company's Journey To Big Data

With the right approach to data science and the right technology platform, companies can gain a shorter tim...

Next
From Sea to Trees, Pivotal Data Science Looks at Climate Change in Acadia National Park: Day 4 (Final Day) Field Report
From Sea to Trees, Pivotal Data Science Looks at Climate Change in Acadia National Park: Day 4 (Final Day) Field Report

It’s our final day of work and fun at Acadia National Park. So far, we’ve learned about the research proble...

Enter curious. Exit smarter.

Learn More