Expanded boot partition to upgrade from Fedora 14 to Fedora

Programming, for all ages and all languages.
Post Reply
rknox
Member
Member
Posts: 55
Joined: Wed Apr 28, 2010 9:07 am

Expanded boot partition to upgrade from Fedora 14 to Fedora

Post by rknox »

Once upon a time I installed Fedora 12 - took the defaults - got a 200MB boot partition and the rest of the disk was allocated to one LVM partition. I have used preupgrade to move to newer versions. When I try to go from Fedora 14 to 16 it fails because boot partition is not big enough. There are various suggestions on how to free space in boot partition but these are small potatoes compared to what is needed. The boot partition must be larger for preupgrade to run.

How I enlarged the boot partition given that the rest of the disk was full. Two options - (1)understand the LVM utilities sufficiently to shrink partition 2 or (2)move from my 40GB Maxtor to a larger disk. For $22 delivered I could get a used 80GB Maxtor disk from eBay so I got it.

Various people suggested perhaps 10 programs that would help. None of them is ready to deal with an ext4 partition backed by a LVM partition were resizing and moving is involved. Some claim they deal with the situation but when you try you find they do not.

But it was easy using utilities plus a small throw away program.

It took 3 steps.

Old drive is on sdb new drive on sda Fedora 16 live CD on CD drive.

1. Clone old drive to new
Booted from live CD: dd if=/dev/sdb of=/dev/sda

2. Calculate new values for the Partition table in the Master Boot Record. - booted from old drive

2.1 Copy MBR to disk: DD if=/dev/sda of=sda_mbr.in count=1

2.2 Wrote a throw away c program to calculate new partition table values - print a report - write a new file named sda_mbr.out. The format of the MBR is available everywhere including the format of the partition table. I doubled the size of partition 1.

let SZ1 be size of partition 1
let ST2 be start of partition 2
let III be a 4 byte integer
read file sda_mbr.in
print a formatted copy of the MBR before the change
III = SZ1
SZ1 +=III
ST2 += III
print a formatted copy of the MBR after the change
create a new file sda_mbr.out and write modified MBR to it.

For my particular situation the values of interest for later steps were:
start of partition 2 on old disk = 409663
start of partition 2 on new disk = 819263
size of partition 2 = 79883207

2.3 Put this new MBR on the new drive
DD if=sda_mbr.out of=/dev/sda count=1

3. Booted from live CD
Expand the file system in partition 1 on new drive to use the space now allotted to it in the partition table -

e2fsck -f /dev/sda1
resize2fs /dev/sda1

copy partition 2 from old drive to its new location on new drive
DD if=/dev/sdb of=/dev/sda skip=409662 seek=819263 count=79883207

Done! boot /dev/sda - everything is ok, Fedora 14 runs fine and I have a big boot partition and a large unallocated space on the disk.

Step 2 (boo!): I ran preupgrade on the 80GB drive and installed Fedora 16 and after all this trouble I don't like Fedora 16. Maybe I don’t "get it" but it uses almost twice the memory - runs slower - does not seem to have a "stay on top" option. My defaults for opening a downloaded file are all messed up and suggest gedit for all file types. I will play with it and see if I can love it - but at this moment I'm disappointed. I am back on my 40GB Fedora 14 disk. Maybe I'll redo the above (but not upgrade to Fedora 16) and then I'll be running Fedora 14 on the 80 GB disk.
Post Reply