I'm trying to set up raid1 on my linux machine and all the tutorials explain changing your grub config. Fine, but I like to understand what I'm doing. The man page for grub leaves out the interesting bits when explaining the root command. The command looks like "root /device/ [hdbias]" and device looks something like "hd(0,0)" or "hd(1,0)" but it doesn't explain what these numbers correspond to, and since my drive setup isn't exactly like theirs I question putting them in my grub config without knowing if I'm pointing to the correct drive. What do the device numbers mean?
1 Answers
Grub is a bit weird in it's device naming scheme. The part that says
root (hd0,0)
tells grub where to find the boot partition. This has to be a physical partition, like sda1. In the above example, hd0,0 means the first partition of the first physical drive. Sadly, grub does not follow the normal convention of calling the first partition 'partition 1', but calls it 'partition 0' instead. Nothing to be done about that.
The line that says
kernel /vmlinuz-2.6.18-128.el5 ro root=/dev/Volume00/LogVol00
tells the kernel where the root partition is. in this case on a logical volume called /dev/Volume00/LogVol00. The kernel understands LVM and more (grub does not) so it is okay to use LVM or dmraid or whatever here. Be sure to use a ramdisk with the necessary modules though.
if you use the interactive grub shell, tab completion will show you the possible choices for the root device if you type root(hdTAB) or root(hd0,TAB).
![](../../users/profiles/3950.webp)
- 10,269
- 2
- 32
- 47
-
okay, so here's the problem. I don't have a boot partition. /boot is a directory in my root partition. my grub menu.lst says root hd(0,0) and the kernel and initrd are relative to / ... kernel /boot/vmlinuz-2.6.24-24-generic root=UUID=d8c402cc-7445-4878-b3aa-c9568b740b51 ro single initrd /boot/initrd.img-2.6.24-24-generic So you just need to tell grub where the boot files are, they don't have to be in the root directory of its own partition? – Stu Aug 18 '09 at 11:27
-
In that case root(hd0,0) is ok, assuming your Linux partition is the first partition on your first disk. – wzzrd Aug 18 '09 at 12:16
-
Cool, thanks. I think I'm starting to get the idea. The way all the docs are written it sounds like /boot had to be its own partition, but I guess not. So I just have to make root(hdx,y) be the partition with the boot information on it, even if it's not the only thing in the partition. – Stu Aug 18 '09 at 13:42
-
One more quick related question. Does fdisk -l yield the partition/drive list in the grub recognized order of what is the 'first' drive? – Stu Aug 18 '09 at 13:44
-
Have you tried the tab-completion I mentioned earlier? That should point you into the direction of finding out what your primary drive is. As far as fdisk is concerned: I'm inclined to say 'yes' here, but it's more of a gut-feeling than that I'm actually sure of this. – wzzrd Aug 18 '09 at 15:33
-
yeah, the tab completion is helpful, but if I can't identify my drive by the partition table, there's still no way to be 100% sure, but at least now I understand what's going on, which is what I was originally trying to find out. Thanks. – Stu Aug 18 '09 at 16:06