Find your partitions and kernel from the GRUB command line
You may find that grub is pretty useless when your menu.lst is missing or misconfigured. It’s not easy to figure out how to make grub tell you where the files are that you need. Here’s the methods I use to find out where everything is that I need in order to boot, just using the grub bootloader and nothing else.
Start by specifying the boot partition.
grub> root (hd1,0)
root (hd1,0) Filesystem type is fat, partition type 0x6 grub>
That’s not the right one. That’s probably a USB thumbdrive or other storage device.
You can find it by using tab completion. Type this:
grub> root (hd0,
and hit tab from here…
Possible partitions are: Partition num: 0, Filesystem is ext2fs, part type 0x83 Partition num: 1, Filesystem is unknown, part type 0x82 Partition num: 2, Filesystem is ext2fs, part type 0x83
I’m looking for a Linux partition, which is type 83. (82 is swap)
grub> root (hd0,0)
root (hd0,0) Filesystem type is ext2fs, partition type 0x83 grub>
Now I’ll search for /sbin/init which will tell me where my root partition is.
grub> find /sbin/init
find /sbin/init (hd0,1) grub>
So now I know num 2 is the root partition, which means num 0 is probably boot.
If you didn’t compile your kernel yourself, it probably has a file name that is hard to remember, and you are likely to have an initrd too. You can find the full file names using tab completion here too.
grub> rootninja (hd0,0)/
Hitting tab after that slash will tell you all the files in the root of that partition.
Possible files are lost+found boot kernel.x86 kernel-stripped.i386 grub System.map things-in-a-bag vmlinux vmlinux-2.6.27
Looks like I have two kernels, kernel.x86 and kernel-stripped.i386, a boot and grub directory, and a few extra files. Now I know how to make my kernel line! If you had initrd files, you’d see them in here too.
Two more commands and it will start to boot.
kernel /vmlinux-2.6.27 root=/dev/sda3
[Linux-bzImage, setup=0x2c00, size=0x2ddaf0]
boot
Decompressing Linux...
I’ll need just a few lines for the menu.lst so I won’t have to poke around and bring the system up manually from now on.
timeout 3 default 0 title rootninja root (hd0,0) kernel /vmlinux-2.6.27 root=/dev/sda3
















Recent Comments