I have a setup like so:
Dom0 LV
|
DomU Physical Disk
| |
XVDA1 XVDA2
(/boot) (DomU PV)
|
VolGroup00
(DomU VG)
| |
LogVol00 LogVol01
(swap) (/)
I am trying to resize the DomU root Filesystem. (VolGroup00-LogVol01) I realize that I now need to resize the partition XVDA2, however when I try doing this with parted on Dom0 it just tells me "Error: Could not detect file system."
So to resize the root part VolGroup-LogVol00 shouldn't the process be:
# Shut down DomU
xm shutdown domU
#Resize Dom0 Logical volume
lvextend -L+2G /dev/volumes/domU-vol
# Parted
parted /dev/volumes/domU-vol
# Resize root partition
resize 2 START END
(This is where I get an error) "Error: Could not detect file system."
# add the vm volume group to Dom0 lvm
kpartx -a /dev/volumes/domU-vol
# resize the domU PV
pvresize /dev/mapper/domU-pl (as listed in pvdisplay)
# The domU volume group should automatically adjust
# resize the DomU lv
lvextend -L+2G /dev/VolGroup/LogVol00
And then obviously increase the fs, remove the device from kpartx etc
The problem is I dont know how to resize the partition? How do I resize this partition so I can run pvresize on the DomU?
Thanks
Here are the steps that I roughly followed to resize a KVM guest that used LVM internally.
run fdisk inside VM and delete & re-create LVM partition
Reboot the VM
Resize the LVM physical volume
Resize the LVM Logical Volume
Grow the File system
The above is my example, but I followed the steps on this website
So, to clarify: you need to resize the root LV inside the VM, but the VG is full so you first need to resize the physical partition the PV lives on? Assuming that is correct, we continue...
I'm surprised that parted would have such a hissy-fit over the dom0 partition. From it's point of view, it's just an in-use LVM PV. I've never been particularly impressed with parted, though, and I just stick with good ol' fdisk.
You'll probably have trouble resizing the partition while the disk is in use, anyway, because rescanning the partition table on a mounted filesystem is... tricky. It'd be best to shutdown the VM and do all the operations from the dom0.
I'd recommend skipping partitions entirely and doing everything with LVM; I also don't like LVM in my VMs because they've got poor enough I/O throughput as it is. Just attach a bunch of LVs from the dom0 for the partitions in the VMs -- this also makes replication easier, as you don't typically want to replicate swap (unless you're doing live migration, but then it's just one more block device to replicate anyway).
Also be very careful when resizing.
It seems the step you are having trouble with is the parted step:
http://www.gnu.org/software/parted/manual/html_chapter/parted_7.html#SEC68
Be careful to follow the note and you may also want to use fdisk -l on the partition to make sure it is the partition type and file system that you expect.
Other good general references that could provide you or others help: http://linuxwave.blogspot.com/2008/08/resizing-your-xen-domu-using-lvm.html
http://www.novell.com/communities/node/4790/how-resize-xen-file-based-disk-vms-ext3-or-reiser-sles-10-sp1
http://webcache.googleusercontent.com/search?q=cache:jNh6rSBUqVEJ:grantmcwilliams.com/tech/virtualization/xen-howtos/265-resize-xen-disk-image-used-as-domu-partition+grant+mcwilliams+xen+resize+howto&cd=4&hl=en&ct=clnk&gl=us