Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Running GRUB, I want to set the kernel root parameter to the same partition (or more generically, to a partition on the same device) as the disk with the bootloader.

Initially, the install set the GRUB menu item to pass /dev/XX as the root parameter:

title XXXXX
    root (hd#,#)
    kernel /boot/vmlinuz-XXXX root=/dev/XX1 resume=/dev/XX2 splash=silent quiet showopts vga=0x###
    initrd /boot/initrd-XXXX

I can change the kernel line to reference my disk's label, increasing its tolerance for appearing in various orders:

    kernel /boot/vmlinuz-XXXX root=LABEL=??? resume=LABEL=swap? splash=silent quiet showopts vga=0x###

I would like to change that line so that I can reference the boot partition, whether it's /dev/sda2 or /dev/hdb6, or even better to reference only a partition number, which the kernel will interpret relative to the boot partition (root (hd#,#) in GRUB).

share|improve this question
1  
If i am understand you qustiin correctly, you can put the UUID of your partition as an argument to the root=UUID and it will stick to the partition no matter what dev node it would be or even from what disk. –  Hanan N. Dec 14 '11 at 13:50
add comment

1 Answer

For a proper installation of grub, this information is irrelevant. You do not need to specify which partition is your /boot as long as it is mounted when you're installing grub. Grub saves in MBR the device (disk) and location of vmlinuz and/ initrd during the installation and a further reference in the grub config is not needed there after.

EDIT

After clarifying that you want "to reference your root partition in relation to your boot partition". There is no option that I know ready for this functionality, but you can add it yourself (so scratch my last comment here). This will involve modifying the init script from your initrd image. E.g. you can add a parameter like bootrel=+1 in your kernel line and add some code to initrd image to find out where is the boot partition and then check the bootrel parameter to find the root partition and set the root parameter accordingly.

This is of-course an overcomplicated and hackish way. Perhaps you're approaching your problem wrong. If you describe more generally what you need to achieve, then maybe someone will offer a more option.

share|improve this answer
    
Are you saying I don't need to specify the root parameter in the kernel line? Or that I should specify root=/? –  palswim Dec 13 '11 at 21:24
    
No, I'm saying you do not have to specify anything about the /boot partition. Isn't that the question? –  forcefsck Dec 14 '11 at 6:07
    
BTW, my thanks to the guy who downvoted without justifying or providing a better answer. –  forcefsck Dec 14 '11 at 6:12
    
No, I'm not asking about the boot partition at all. –  palswim Dec 14 '11 at 17:31
    
@palswim, you're clearly mentioning "boot partition" in your question. So you meant "root partition". That is a bit confusing. Anyway, LABEL or UUID should do what you want. –  forcefsck Dec 14 '11 at 18:46
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.