grub basics – booting from command prompt

Posted: December 20, 2006 in linux

the common things i tend to forget. one way or another a Linux user will have to face this problem one day.. .

so in case there’s no grub boot menu, or you need to edit something, just go to the grub command prompt. press ‘c‘ and you will be taken to the prompt.

enter the following:

grub> root (hdX,Y)
grub> kernel /vmlinuz-i386 root=/dev/hdaX
grub> boot

sometimes you also have to specify the initrd image. it is imperative that the initrd image must match with the kernel you used in the above. if there is a trailing -i386 in the kernel name, then the initrd should have it also.

initrd /initrd-i386

another way of booting from the grub command prompt is by putting the root and kernel statements together, like this:

grub> kernel (hdX,Y)/vmlinuz-i386 root=/dev/hdaX
grub> boot

note that in (hdX,Y), hdX means that it is the harddrive number. so it could be hd0 for the first haddrive on the primary IDE channel. now Y is the partition number of that drive where the kernel resides. so it could be 0 or 1 , depends on where the kernel image is located.

also in grub speak, the first harddrive or partition starts with zero (0). hd0 is equivalent to hda, hd1 is hdb and so on.. . thus (hd1,0) is the first partition on the second harddrive (specifically the slave on the primary IDE channel). in case it should be an external drive connected on the USB port, hd is changed to sd. the rest follows in this case. of course you have to be sure that your USB drive is seen by the kernel. otherwise it wont’ work. there are many ways to doing this. i think this would have to be a feature in your BIOS where you are able to enable your USB devices on boot, or even mount it as if it were a floppy drive.

read related post here


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s