Some time we confusing somehow our linux can not boot. I hope this step can hel you to
solve your problem.
Firstly we need to prepare boot disk with this example I use cd1 from slackware.
because this disk easy for me to got console.
in this example I assume that our system using grub
hereis the step :
1. boot using boot disk till we got console screen
2. try to identify thereis your root and boot partition is :
#fdisk -l /dev/hda
Device Boot Start End Blocks Id System
/dev/hda1 * 1 2167 17406396 83 Linux/dev/hda2 2168 2294 1020127+ 82 Linux swap # mount /dev/hda1 on / type ext3 (rw)
3. we need to chroot the disk that contained our linux boot partition in my case my disk using
/dev/hda1 as / (root)
#mkdir /mnt/sysimage#mount /dev/hda1 /mnt/sysimage #chroot /mnt/sysimage /bin/bash 1#
4. See our boot configuration which use for boot. in my case using hd0,0.
1# cat /etc/grub.conf# grub.conf generated by anaconda# # Note that you do not have to rerun grub after making changes to this file # NOTICE: You do not have a /boot partition. This means that # all kernel and initrd paths are relative to /, eg. # root (hd0,0) # kernel /boot/vmlinuz-version ro root=/dev/hda1 # initrd /boot/initrd-version.img #boot=/dev/hda default=0 timeout=2 splashimage=(hd0,0)/boot/grub/splash.xpm.gz hiddenmenu password --md5 $1$.pCw9vYr$1h2IyME7.HfhjJ36vIrVf1 title CentOS (2.6.9-42.0.10.EL) root (hd0,0) kernel /boot/vmlinuz-2.6.9-42.0.10.EL ro root=LABEL=/1 initrd /boot/initrd-2.6.9-42.0.10.EL.img title CentOS (2.6.9-42.0.8.EL) root (hd0,0) kernel /boot/vmlinuz-2.6.9-42.0.8.EL ro root=LABEL=/1 initrd /boot/initrd-2.6.9-42.0.8.EL.img
5.
1# /sbin/grub
6.
grub> root (hd0,0)
(setting the boot drive where most of GRUB, and the system kernel files are).
7.
grub> find (hd0,0)/boot/grub/stage1
//(the first file GRUB uses to boot up from). This step may not be necessary, but I wasn’t about to erase a master bootblock, and try again, just to see if it was.
(hd0,0)
9.
grub> setup (hd0)
(to install the bootloader to the drive my system BIOS boots up).
setup (hd0) Checking if "/boot/grub/stage1" exists... yes Checking if "/boot/grub/stage2" exists... yes Checking if "/boot/grub/e2fs_stage1_5" exists... yes Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded. succeeded Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/boot/grub/stage2 /boot/grub/grub.conf"... succeeded Done.
11.
grub> quit
10. now try our new boot loader
# cd / # reboot