by Void Main » Tue Apr 05, 2005 5:22 pm
No, you can not extend a partition from the beginning. There must be free space *after* the partition you want to resize. If the space is before you must "slide" the partition to be enlarged forward on the disk so the free space is after it. You can do this with qtparted booted from a KNOPPIX CD or from a 3rd party utility like BootitNG, etc.
Now, the names of the partitions (hda1, hda2, etc) are not nearly as important as the starting and ending cylinder numbers because the partitions don't necessarily have to be in order by name on your disk and yours just happen to *not* be in order. In your case the partition order is:
0 - hdb1 - primary
1 - hdb4 - primary
2 - hdb3 - primary
3 - hdb2 - extended container (containing hdb5)
3-A hdb5
Now which one of those did you want to delete in order to make room to enlarge one of the others? And which one of the others did you want to enlarge?
If you want to get rid of hdb4 and incorporate that space into hdb3 then you have to delete the hdb4 partition (I use /sbin/fdisk for this). After you delete that partition you have to slide hdb3 forward on the disk so it starts where hdb4 used to start (starting cylinder of 730). Again, use qtparted or BootitNG to slide the partition without losing your data. Once you have moved the partition (and it's data) you have to delete the partition and recreate it with the new size. In this example you would recreate your hdb3 Linux partition with the starting cylinder of 730 and an ending cylinder of 4080. Again, I prefer to use /sbin/fdisk for this. Now that you have your partition enlarged you still have to enlarge your file system. Use resize2fs to resize it to the full size of the partition (assuming the file system is ext2 or ext3, use appropriate resize tool for whatever file system you are running). I have done this many times and have never lost any data doing it. With the 2.6 kernel you are actually supposed to be able to resize2fs a live file system but I have never tried it. I feel more comfortable booting from alternate media.