- fdisk
- filesystem
- ext3
- resize
Online filesystem resize
Sometimes you just can't get your hands on a physical machine. So today I had to resize a live filesystem. No rescue CD's or whatever. It is possible :).
You'll need just the fdisk command and resize2fs.
First just list your current partition table
fdisk -l /dev/sda
Remember all those values in case you fuck up.
Well just delete all partitions and recreate them while using the same partition numbers and filesystem id's! Otherwise you'll run into trouble at next reboot.
Once you recreated the partition table. Just save it using 'w'. Fdisk will tell you it continues to use the old filesystem table until next reboot. Just reboot your machine. You might run into an error when it wants to mount the swap filesystem but ignore that.
Once rebooted you can see the filesystem still has it's old size. Just resize it by issuing: (watch out for the right partition number!)
resize2fs /dev/sda1
It will finish succesfully (I hope) and your filesystem will use it's new space.
Just finish off by setting a swap signature on the swap space if needed.
mkswap /dev/sda5
You have to know what you are doing, so it's your own risk!