Resizing boot/root partition

Posted: 2005-12-29

Background: A debian machine (unstable) with a 100Mb root/boot ext3 partition (hda1), a 500Mb swap space (hda2) and the rest of the disk under lvm2 (hda3).

Problem: I use a custom kernel (needs the EVMS block device kernel patch). And not enough space to build or install the next kernel - 100Mb is simply too small.

Solution

  1. Create a 256Mb swap space under the lvm2 area [mkswap]
  2. Remove the old swap space (remove partition) and create a new one using only half the space (leaving space after hda1) [fdisk, mkswap]
  3. Configure both swap disks in fstab (use pri=nn option to use hda2 first)
  4. Boot into knoppix (I used the 4.0.2 CD)
  5. In fdisk note the start cylinder of hda1 then delete hda1
  6. Create a new hda1 - make sure it uses the same start cylinder but now fills all the space up to hda2
  7. Commit the partition table (I needed to reboot knoppix for the kernel to update its view)
  8. Run e2fsck -f /dev/hda1
  9. Run resize2fs -p /dev/hda1
  10. Reboot from disk - all done

Notes - I use grub - I assume that lilo will also tackle this - but - no guarantees.