[CentOS] HELP, I accidentally initialized my /boot partition

Mon Aug 20 20:06:48 UTC 2007
Phil Schaffner <Philip.R.Schaffner at NASA.gov>

On Mon, 2007-08-20 at 12:30 -0700, John R Pierce wrote:
> Alfred von Campe wrote:
> > So I installed a second drive in my system today, and instead of 
> > typing "mkfs.ext3 /dev/sda1" I did a "mkfs.ext3 /dev/hda1".  
> > Fortunately, that was just my /boot partition.  I thought I could
> just 
> > copy the contents from the /boot partition from another system, but 
> > that didn't work as expected.  The again, I don't have another
> system 
> > that's identical to the mine.

A few more details about the failure mode might get you better help -
"didn't work as expected" is not very descriptive. Did you try to
reboot?  What happened?  What else have you tried?  Can you boot from
rescue media?  What is currently in /boot/...?

http://catb.org/~esr/faqs/smart-questions.html

> >
> > What is the best way to re-create the /boot partition for my system?
> 
> grub.conf will be the main problem...  and possibly whats in the
> initrd 
> if extra drivers need to be loaded to complete the boot (I believe
> this 
> is built by mkinitrd) 

May also need to fix /boot/grub/device.map.

Recreating /boot/grub/grub.conf will require knowledge of the
partitioning and filesystem layout.  Do you have a boot partition?
Where is / (root partition)?  Using LVM?  Using partition labels?  Look
at /etc/fstab to see what is to be mounted where.  This should give you
clues as to what belongs on the kernel line in /boot/grub/grub.conf.

You will likely need to create a new initrd-<version>.img for at least
the latest kernel.  For the latest CentOS 5 kernel the command would be:

# mkinitrd -f /boot/initrd-2.6.18-8.1.8.el5.img 2.6.18-8.1.8.el5

A forced reinstall of the kernel, as suggested elsewhere in the thread,
could do this for you but may be tricky when booting from rescue media.
The rpm installer script for the kernel might also get confused
if /boot/grub/grub.conf is incorrect as it seems to use existing GRUB
entries as a model for new ones.

Good luck,
Phil