I just had to resize a virtual disk and it was harder than I thought; writing down what I did so it’s easy to find …

  1. shutdown VM
    qm shutdown 108
  2. resize disk image
    qemu-img resize vm-108-disk-1.qcow2 +20G
  3. attach pmagic CD; boot to pmagic (using proxmox management web interface)
  4. extend physical partition
    pvdisplay; lvdisplay; 
    fdisk -u=sectors /dev/sda
    delete partition 2 (remember starting sector) (‘d’, 2)
    create new partition (n) starting at same sector as before; end is defaulted
  5. extend pv
    pvresize –v /dev/sda2
  6. extend lv
    lvresize –L +20G VolGroup/lv_root
  7. resize filesystem
    e2fsck –f /dev/sda2
    resize2fs /dev/sda2
  8. detach pmagic cdrom
  9. start VM
    qm start 108

 

Good instructions for working with Windows (NTFS) disk images is here: http://cauldrondevelopment.com/blog/2009/02/26/resize-qemu-ntfs-image/

Advertisements