Fri Oct 10 16:44:48 EDT 2014

Resizing ext4

1. Resize underlying block device
2. Run resize2fs[1]

For a VM this seems to work best:

- If swap is needed, put it before the root partition

- extend the .img using 

  dd if=/dev/zero of="$2" seek=$1 obs=1 count=0

- resize the main partition:

  modprobe nbd max_part=16
  qemu-nbd -c /dev/nbd0 hd.img
  parted /dev/nbd0
  unit s
  print  # take note of start, e.g. 2048s
  rm 1
  mkpart primary 2048s 100%
  qemu-nbd -d /dev/nbd0 

- resize partition insize vm using

  resize2fs /dev/sdaX

[1] https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/ext4grow.html