Recovering Fedora 14 with formatted /boot

Just yesterday, I was excited to try the new release of Fedora, the Fedora 16, and so I installed it directly to unused partition of my drive and I accidentally formatted my current /boot partition without doing any backup to it.

I was rattled and pissed off by what I have done. So I google for the answer on "How to recover formatted /boot". Luckily, I got an information on how to solve the problem. So it went like this:

First, I downloaded a copy Fedora 14's GNOME LiveCD and burned it to a DVD(because I don't have any CD-R :P). After I burned, I booted the LiveCD and opened a Terminal.

My current hard drive partitions layout:
/dev/sda1 - boot partition
/dev/sda2 - unused partition - where I installed the Fedora 16
/dev/sda3 - the swap
/dev/sda4 - extended
/dev/sda5 - root partition of Fedora 14
/dev/sda6 - the home partition

I've created a directoy /mnt/fedora-14 and mounted the Fedora 14's root to it.
$ su -
$ mkdir -p /mnt/fedora-14
$ mount /dev/sda5 /mnt/fedora-14

and I mounted the current boot partition under the fedora-14 partition.
$ mount /dev/sda1 /mnt/fedora-14/boot

After that, I chroot-ed to fedora-14 mount point and worked on the fedora 14 root partition instead of the LiveCD root partition.
$ chroot /mnt/fedora-14

So here I thought that I could just do:
$ yum install kernel
but I was wrong. I got into ...

(paused)
[reading Bleach 474 and Naruto 564]
(resumed)

network problems, specifically the domain name of each yum URL mirror were not resolved into an IP address. So what I did was I look for a site where I could download the latest kernel which I found this http://archives.fedoraproject.org/pub/archive/fedora/linux/updates/14/i386/kernel-2.6.35.14-103.fc14.i686.rpm. And I have to find out what is the IP of the domain name so I went to this site http://www.hcidata.info/host2ip.htm and gotten this IP address '209.132.181.27'. I changed the URL to this URL http://209.132.181.27/pub/archive/fedora/linux/updates/14/i386/kernel-2.6.35.14-103.fc14.i686.rpm and installed it using rpm command instead of 'yum localinstall' because the yum were producing errors.
$ rpm -ivh http://209.132.181.27/pub/archive/fedora/linux/updates/14/i386/kernel-2.6.35.14-103.fc14.i686.rpm

The next step was to add the installed kernel to the new grub configuration which, at first, I thought was an easy step but to my surprise it was not. The whole grub's configuration was written differently so I rebooted to the Fedora 16.

But luckily, The whole reconfiguration was very easy. I just executed 'grub2-mkconfig' and the script took care of everything..
$ grub2-mkconfig -o temp.conf

In this part, I modified the created conf 'temp.conf' to boot the Fedora 14's root. The configuration of Fedora 14's kernel in 'temp.conf' configuration was looked like this:

$ vim temp.conf

menuentry 'Fedora Linux, with Linux 2.6.35.14-103.fc14.i686' --class fedora --class gnu-linux --class gnu --class os {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='(hd0,msdos1)'
        search --no-floppy --fs-uuid --set=root 9c614f48-f086-43a0-ac6c-da2e005a86af
        echo    'Loading Linux 2.6.35.14-103.fc14.i686 ...'
        linux   /vmlinuz-2.6.35.14-103.fc14.i686 root=UUID=7cf5c7ee-e65d-4dd3-bd55-40aa2a281142 ro rd.md=0 rd.lvm=0 rd.dm=0  KEYTABLE=us quiet SYSFONT=latarcyrheb-sun16 rhgb rd.luks=0 LANG=en_US.UTF-8 
        echo    'Loading initial ramdisk ...'
        initrd  /initramfs-2.6.35.14-103.fc14.i686.img
}

I changed the first red to msdos4 because the root partition of Fedora 14 is in /dev/sda5 (the index number of grub starts at 0 so I just subtracted one to the index of the partition). And the second red was changed to the location of Fedora 14's root partition too. Here, I have to used LABEL instead of UUID because the root partition of Fedora 14 have a label of "_Fedora-14-i686-". So now the configuration looked like this:

menuentry 'Fedora Linux, with Linux 2.6.35.14-103.fc14.i686' --class fedora --class gnu-linux --class gnu --class os {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='(hd0,msdos4)'
        search --no-floppy --fs-uuid --set=root 9c614f48-f086-43a0-ac6c-da2e005a86af
        echo    'Loading Linux 2.6.35.14-103.fc14.i686 ...'
        linux   /vmlinuz-2.6.35.14-103.fc14.i686 root=LABEL=_Fedora-14-i686- ro rd.md=0 rd.lvm=0 rd.dm=0  KEYTABLE=us quiet SYSFONT=latarcyrheb-sun16 rhgb rd.luks=0 LANG=en_US.UTF-8 
        echo    'Loading initial ramdisk ...'
        initrd  /initramfs-2.6.35.14-103.fc14.i686.img
}


And copied the 'temp.conf' to '/boot/grub/grub.cfg'
$ cp temp.conf /boot/grub/grub.cfg


The last part was I modified the fstab of Fedora 14's configuration because everything was different.
$ mkdir -p /mnt/fedora-14
$ mount /dev/sda5 /mnt/fedora-14
$ vim /mnt/fedora-14/etc/fstab



Comments

  1. Making Money - Work/Tennis: The Ultimate Guide
    The way you would expect from betting on the tennis matches หารายได้เสริม of tennis is to febcasino.com bet on worrione the ventureberg.com/ player you like most. But https://septcasino.com/review/merit-casino/ you also need a different

    ReplyDelete

Post a Comment

Popular Posts