I have a RHEL 5.4 server running as a Xen Dom0, and wish to install several RHEL 5.4 DomU guests using LVM as the guest disks. I have created the following two LVs:
xen-test02-root VM-VG -wi-a- 6.00G
xen-test02-swap VM-VG -wi-a- 512.00M
I used the custom partitioning option when installing the guest so no LVM is used in the guest, only 2 disks. One for / (xvda) and one for swap (xvdb).
This all works fine, but now I wish to test extending the root partition. So far, I have tried using lvextend from the Dom0. This works:
# lvextend -L +4GB /dev/VM-VG/xen-test02-root
Extending logical volume xen-test02-root to 10.00 GB
Logical volume xen-test02-root successfully resized
fdisk shows that the disk is now 10.7GB:
# fdisk -l /dev/VM-VG/xen-test02-root
Disk /dev/VM-VG/xen-test02-root: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/VM-VG/xen-test02-root1 * 1 783 6289416 83 Linux
I now wish to extend the partition on that disk with parted:
(parted) print
Model: Linux device-mapper (dm)
Disk /dev/mapper/VM--VG-xen--test02--root: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 6440MB 6440MB primary ext3 boot
(parted) resize 1 32.3kB 10.7GB
Error: File system has an incompatible feature enabled.
(parted)
Any clues as to what I'm doing wrong? Is parted the best tool to resize partitons? Should I be using LVM differently for Xen guests?
Many thanks, z0mbix
Your problem here is that you can't resize ext3 partition with parted. you have to remove the journal (turning ext3 into ext2) and then resize.
see this for more info
http://www.hermann-uwe.de/blog/resizing-ext3-partitions-with-parted
Why are you partitioning the LV, instead of just using it directly? Also, if you are going to be manipulating the partition table, it's best to do it in the guest. Worst, it looks like you might be trying to fiddle with the partition table in the dom0 while the domU is still running... dangerous.
My simple recipe for resizing a domU disk, which I've done probably in excess of a hundred times by now, is to have the domUs with the LV as the full root partition (xvda1) and then running:
And voila, all done. For non-root filesystems, you can just detach/reattach (useful for swap, in particular), but root needs the reboot.
In your XEN config, don't attach the LV to xvda, attach it to something like xvda1 etc. The xvda device in your domU won't exist, but your domU will still see /dev/xvda1 as a valid partition.
done!