EC2

Resize root disk

  1. Create and start an EC2 instance with the same OS (+version)
  2. Create a snapshot of the original root volume
  3. Create a new volume from the snapshot (source)
  4. Create a new larger/smaller volume (target)
  5. Connect the source as xvdf
  6. Connect the target as xvdg

Run these commands:

e2fsck -f /dev/xvdf1
resize2fs -M -p /dev/xvdf1

Note: save the amount of blocks this results in to calculate the new blocks: (result) * 4 / 1024 = (new blocks)

dd bs=1M if=/dev/xvdf of=/dev/xvdg count=new blocks
e2fsck -f /dev/xvdg1

Connect the target volume to the original instance as /dev/sda1 and boot from the newly created volume.