----- Original Message ----- | Hello, | | Today a virtual server under my administration ran out of disk space, so | I had to get extra space to it.. while it was running, because it's an | important web server without any kind of HA/Load Balancing (don't do | that, kids). | | So what happened, is that after another administrator had extended the | disk from VMWare, I tried to extend it from the OS side. | | Everything went well, listing my steps here: | | * echo 1 > /sys/class/scsi_device/2:0:0:0/device/rescan | * fdisk /dev/sdb (the usual, delete partition and make a new, bigger one) | | Now's when the problems happened. After writing the partition table I | got the usual "Busy" error. But I needed to do this without downtime. | So, what did I try to get the kernel acknowledge the partition size change: | | * hdparm -z /dev/sdb | * partx -a -v /dev/sdb | * partprobe -s | * echo "1" > /sys/block/sdb/device/rescan | | And while dmesg reported that it recognized the partition change, LVM | did still not see it. So eventually, I was still forced to reboot, after | which everything (pvresize, lvresize, resize2fs) worked fine. Environment: | | * A VMWare virtual machine | * CentOS 6.7 (Final) | | Is there any other way I'm missing? Is this caused by the fact that I | was trying to resize a partition that is under the root file system? If | so, then is it really impossible to do it live? | | Thanks, | | -- | Sander Kuusemets | University of Tartu, High Performance Computing, IT Specialist |
If the disk is not the OS disk I never put a partition table on it if it's going to be used with tools like LVM. I simply create a full disk physical volume and provision it using volume groups and logical volumes. In this case I just rescan the bus to see the new size, do a pvscan/presize and then expand the VGs or LVs as necessary.