Linux 101: Extend root partition of an InsightIQ VM

While upgrading OneFS it’s important to keep the InsightIQ software version compatible with the Isilon systems. In this case, InsightIQ wasn’t updated for a while and I had to upgrade from 3.0 -> 3.1 -> 3.2 -> 4.x. The actual upgrade process isn’t too hard (it just takes a lot of time), but there’s one little prerequisite in the 3.1 -> 3.2 upgrade: a minimum free space in the root partition of 502MB. As you can see in the screenshot, I wasn’t even close to the minimum requirement. I got to 357 MB, and that’s after cleaning up redundant stuff. Time to add some more disk space and extend root partition!

Disclaimer: Typos cause data loss!

First of all, a disclaimer/warning. If you make a typo in the following commands, you’re at risk of losing your InsightIQ virtual machine. While not rocket science, you’re using some advanced commands with the potential of wrecking the data on the disk. So I’d recommend to take a snapshot beforehand, and to be careful and check your input during the process.

Additionally, drive names and partition numbers used in the examples might be different for your InsightIQ machine. Make sure you substitute them to the values that match your environment.

Fdisk and extend the disk

We’ll be working on the /dev/sda drive, so start up fdisk with fdisk /dev/sda. Hit p to list the partitions.

Take note of the total disk size (4831MB) and the location of the root partition on the disk (last partition #3). The first piece of information is important to verify that you’ll be expanding the correct disk in VMware. The second is to verify that the root partition is at the end of the disk, and thus can be easily extended without having to move other partitions. You can only add space to the last partition of a disk, so if the swap partition was third and root was second, we’d have to delete the swap partition, then extend root partition and recreate the swap partition. But in our case, it’s simple.

Go to your hypervisor client and extend the disk. In our case, we added roughly 1GB. Afterwards, reboot the InsightIQ virtual machine and run the fdisk command again to verify the expansion. You can also run fdisk -l if you want to make it less interactive.

As you can see, the disk size jumped to 6442 MB, and there are now 783 cylinders instead of the old 587. However, you’ll also see that the End cylinder of the root partition /dev/sda3 is still at 588. So next step is to…

Extend root partition

What we’re going to do is to delete the old root partition, then recreate it with the same starting cylinder and the new end cylinder. It is absolutely vital that you use the same starting cylinder, or you’ll destroy the partition. So make good notes on the old situation!

The above steps look like this in a CLI, after you’ve started fdisk with fdisk /dev/sda3.

The steps in the screenshot to extend root partition are:

Delete the old root partition #3.

List the partition table to check the results.

Create a new primary partition #3, with the old starting cylinder 287 and the highest possible end cylinder 783.

Relist the partition table and check the results and the partition type (83).

If you are ABSOLUTELY sure you didn’t make any mistakes, write the changes to disk with w. If you aren’t, revert the changes and quit by pressing q, and try again.

Next, follow the instructions and reboot the machine. Fingers crossed it boots up correctly… 😉

Extend root filesystem

If the machine boots, we’re almost there. The final step is extending the filesystem. We’ll do this using the resize2fs /dev/sda3 command.

If you list the filesystems again with df -h, it should now show you a bit more free space. Great job, you can now continue with the InsightIQ upgrade! Make sure to read the next article on disowning Linux processes, since a few of these upgrades take a LONG time…