Centos Xen resizing DomU partition and volume group

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.

  1. Shutdown the VM
  2. add more space to the guest's "image file" (something like: cat old.img 10G_addon.raw >> new.img
  3. start the VM (using the newly created new.img)
  4. run fdisk inside VM and delete & re-create LVM partition

    % fdisk /dev/vda
    ...
    Device Boot      Start         End      Blocks   Id  System
    /dev/vda1   *           1          13      104391   83  Linux
    /dev/vda2              14        3263    26105625   8e  Linux LVM
    
    Command (m for help): d
    Partition number (1-4): 2
    
    Command (m for help): p
    
    Disk /dev/vda: 48.3 GB, 48318382080 bytes
    255 heads, 63 sectors/track, 5874 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
    Device Boot      Start         End      Blocks   Id  System
    /dev/vda1   *           1          13      104391   83  Linux
    
    Command (m for help): n 
    Command action
      e   extended
      p   primary partition (1-4)
    p
    Partition number (1-4): 2
    First cylinder (14-5874, default 14): 14
    Last cylinder or +size or +sizeM or +sizeK (14-5874, default 5874): 
    Using default value 5874
    
    Command (m for help): p
    
    Disk /dev/vda: 48.3 GB, 48318382080 bytes
    255 heads, 63 sectors/track, 5874 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
    Device Boot      Start         End      Blocks   Id  System
    /dev/vda1   *           1          13      104391   83  Linux
    /dev/vda2              14        5874    47078482+  83  Linux
    
    Command (m for help): t
    Partition number (1-4): 2
    Hex code (type L to list codes): 8e
    Changed system type of partition 2 to 8e (Linux LVM)
    
    Command (m for help): p
    
    Disk /dev/vda: 48.3 GB, 48318382080 bytes
    255 heads, 63 sectors/track, 5874 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
    Device Boot      Start         End      Blocks   Id  System
    /dev/vda1   *           1          13      104391   83  Linux
    /dev/vda2              14        5874    47078482+  8e  Linux LVM
    
    Command (m for help): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    
    WARNING: Re-reading the partition table failed with error 16: Device or 
    resource busy.
    The kernel still uses the old table.
    The new table will be used at the next reboot.
    Syncing disks.
    %
    
  5. Reboot the VM

  6. Resize the LVM physical volume

    % pvdisplay 
      --- Physical volume ---
      PV Name               /dev/vda2
      VG Name               VolGroup00
      PV Size               24.90 GB / not usable 21.59 MB
      Allocatable           yes (but full)
      PE Size (KByte)       32768
      Total PE              796
      Free PE               0
      ...
    
    % pvresize /dev/vda2
    
    % pvdisplay
      --- Physical volume ---
      PV Name               /dev/vda2
      VG Name               VolGroup00
      PV Size               44.90 GB / not usable 22.89 MB
      Allocatable           yes 
      PE Size (KByte)       32768
      Total PE              1436
      Free PE               640
      ...
    
  7. Resize the LVM Logical Volume

      % lvresize /dev/VolGroup00/LogVol00 -l +640
      Extending logical volume LogVol00 to 43.88 GB
      Logical volume LogVol00 successfully resized
    
  8. Grow the File system

      % resize2fs /dev/VolGroup00/LogVol00 
      resize2fs 1.39 (29-May-2006)
      Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
      Performing an on-line resize of /dev/VolGroup00/LogVol00 to 11501568 (4k) blocks.
      The filesystem on /dev/VolGroup00/LogVol00 is now 11501568 blocks long.
    

The above is my example, but I followed the steps on this website