VMware allows to extend the size of a virtual disk online – when the VM is running.
The next expected steps for Linux system are:
- extend the partition: delete and create a larger one with
fdisk
- extend the PV size with
pvresize
- use free extents for
lvresize
operations - 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 "/".
Best Answer
You can do this without a reboot. pvresize doesn't resize the physical volume until the partition is updated with the added space. You must fdisk the partition and recreate it with the the new full size of the disk, after you can rescan'd the drives for it to see the extra space in the first place.
More info: http://theducks.org/2009/11/expanding-lvm-partitions-in-vmware-on-the-fly/