How to extend a Linux PV partition online after virtual disk growth

Posted by Yves Martin on Server Fault See other posts from Server Fault or by Yves Martin
Published on 2012-04-10T11:45:13Z Indexed on 2012/10/08 21:40 UTC
Read the original article Hit count: 302

VMware allows to extend the size of a virtual disk online - when the VM is running. The next expected steps for Linux system are:

  1. extend the partition: delete and create a larger one with fdisk
  2. extend the PV size with pvresize
  3. use free extents for lvresize operations
  4. and then resize2fs for file system

But I am stuck on the first step: fdisk and sfdisk still display the old size for the disk.

My disk is a SCSI virtual disk connected thanks to the virtual LSI Logic controller.

How to refresh the virtual disk size and partition table information available in Linux kernel without reboot ?

As far as I know all that steps are possible for a running Windows, without reboot and even without any user actions thanks to VMWare tools. On Linux, I expects to do all steps online too and I already know steps 2, 3 and 4 work online. But the first one - change partition size declared in the partition table (still) seems to require a reboot.

Update: My system is a Debian Lenny with kernel 2.6.26 and the disk I have extended is the main disk with a large PV containing the "root" LV for "/".

© Server Fault or respective owner

Related posts about linux

Related posts about virtualization