[linux-lvm] How to grow LVM and underlying partition?
Yang Zhang
yanghatespam at gmail.com
Sun Nov 28 03:58:18 UTC 2010
I was messing around with a VM running Ubuntu 10.04 Server (64-bit)
with LVM on a single 4GB disk. I just used the installer's automatic
LVM setup and I landed with (ignore the disk size - that was after I
resized the disk to be 8GB):
<<<
Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0004b903
Device Boot Start End Blocks Id System
/dev/sda1 * 1 32 248832 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 32 523 3942401 5 Extended
Partition 2 does not end on cylinder boundary.
/dev/sda5 32 523 3942400 8e Linux LVM
>>>
Ubuntu also made the LVM house just a root FS and a 512M swap.
At this point, I grew the underlying disk to 8GB using the VM
management software, then booted into the VM and tried to figure out
how to grow my swap and root FS. Reading man pvresize:
<<<
...
EXAMPLES
Expand the PV on /dev/sda1 after enlarging the partition with fdisk
pvresize /dev/sda1
...
>>>
This made me figure I had to first enlarge the partition with fdisk.
So I tried deleting the extended partition 2 (which also deleted the
logical partition 5 housing LVM), then recreating both partitions but
this time using all cylinders (with the same partition numbers and
also setting the logical partition's type to 8e for Linux LVM). Alas,
that failed - I rebooted at that point, but the VM would no longer
boot. (Sorry I didn't jot down the exact error message(s), but there
was something about the /dev/mapper/testbox-root not being found - I
can retry the whole experiment if this message is critical.)
So is what I'm trying to do possible? What's the right way to go about
it? Thanks in advance.
More information about the linux-lvm
mailing list