Resizing a linux root disk

I recently had to resize a root disk on a virtual machine. In the past I would have taken an image of the drive and restored it to a new disk., or in this case a larger vdisk. But I thought I would try to see how much I could do online. I must note that in my case, I am working with 2 partitions. One for /boot and the other is an LVM partition. Now, I cannot take credit for this completely. A google search helped. And I am basically going to be posting a link to the post I found.

Resize Disk In Oracle VM

One note I will add, is that the disk, or lun, resize can be done online. You just need to submit a resize command to your root disk. In my case it is sda.

# echo 1 > /sys/block/sda/device/rescan

Once this is complete, you can delete the LVM partition on the disk and recreate it. Unfortunately, you will have to reboot after this step. Partprobe will not be able to rescan the drive. I will admit, there is a possibility that you do not need to reboot. Anyway after the reboot, you do a pvresize on the LVM partition. You can then resize and lvols that need space.

As always, I hope I have helped someone out there on the Interwebs. ;)

Comments