You are reading this article, most probably you faced trouble booting your Linux. Follow the steps below to fully chroot into your system as you booted regularly. Please note that we offer you to take a disk clone before doing anything in your boot configuration. To do so, you can use dd or dd_rescue to clone your disk. attach a bigger hard disk to your server to take its clone, we say bigger as you can easly get confused which drive is your real disk and which is the clone. Put your distros install disk to the CD drive and select rescue from the boot menu, when you reach the prompt, check your disks with the command:

> to see the attached disks, type:

ls /dev/ | grep sd
#sda
#sda1
#sda2
#sdb
#sdb1

> to get additional info about your disks, type:

fdisk -l /dev/sda

instead of sda, you may type sdb, sdc etc. In FreeBSD you may try with /dev/ad0. To start cloning disk type dd with, dd if=/dev/old_disk_id of=/dev/new_disk_id bs=10M.

When you finish clonning your disk, you may de-attach the clone and continue to fix the device. Try the commands below, we assume that you boot from /dev/sda2

mount /dev/sdax /mnt
mount -t proc /proc /mnt/proc
mount -t sysfs /mnt/sysfs
mount –bind /dev /mnt/devchroot /mnt

To mount your additional drives such as RAM drives & etc you should mount them with:

mount -a

Now, you reached your original system with all resources, you can even use rpm and yum and even start your services.

> to fix system boot:

GRUB issues

find the boot drive with fdisk, marked with (*)

fdisk -l /dev/sda
Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 535 4192965 82 Linux swap / Solaris
/dev/sda3 536 1057 4192965 83 Linux
/dev/sda4 1058 30401 235705680 5 Extended
/dev/sda5 1058 30401 235705648+ 83 Linux

In the example above, the first partition is used for booting the system. type “grub” to log in to the Grub interface, /dev/sda is the first disk as hd0 and /dev/sda1 is identified as (hd0,0) in grub, use hd0,1 for sda2 and hd0,2 for sda3 respectively as needed:

root (hd0,0)
find /boot/grub/stage1 #if it gives error try other alternatives
setup (hd0,0)

Booting problems caused by hardware changes:

If you made a significant change in the hardware, you might be missing additional modules from the kernel, you may re-install the kernel to fix the problem (easiest way):

rpm -qa | grep kernel # remove the current kernel & re-install it
rpm -e kernel.2.6…
rpm -Uvh kernel.2.6… #or
yum install kernel.2.6..

Leave a Reply

Your email address will not be published. Required fields are marked *