Skip to contentSkip to conversation

Is it possble to use /dev/disk/by-id/ in grub.conf?

DISCUSSION Aniruddha 3 participants 7 messages Jul 30, 2008

lore
Share & tools
lore

Aniruddha

author
#0 lore raw

Hi,

First of all my apologies if this is the wrong medium to post my question, this was most appropriate medium I could find.

I wonder if it is possible (and if so how) to to define a (real_)root device in grub.conf for a /dev/disk/by-id/. I know it's possible for uuid but uuid also keeps renaming my harddrives whereas /dev/disk/by-id works fine. Thanks in advance!

Regards,

Aniruddha

#1 lore raw
Quoted 9 lines · Aniruddha

Hi,

First of all my apologies if this is the wrong medium to post my question, this was most appropriate medium I could find.

I wonder if it is possible (and if so how) to to define a (real_)root device in grub.conf for a /dev/disk/by-id/. I know it's possible for uuid but uuid also keeps renaming my harddrives whereas /dev/disk/by-id works fine. Thanks in advance!

I believe disk IDs are not supported yet. If you describe your problem in more details, it may motivate somebody to add disk ID support. Or perhaps you are missing a simple solution possible with the current code.

Signature · 2 lines
Regards,
Pavel Roskin
author
#2 lore raw
Quoted 4 lines · Pavel Roskin

I believe disk IDs are not supported yet. If you describe your problem in more details, it may motivate somebody to add disk ID support. Or perhaps you are missing a simple solution possible with the current code.

Thanks for your quick response. The problem is that udev keeps changing my harddrive names at each boot. Normally my root partition resides on /dev/sdc2. However with each reboot this name changes (the last three boots it changed from /dev/sdb2 to /dev/sdf2 to /dev/sdc2).

I solved this partially by changing the /dev/sdc2 entry in fstab with a /dev/disk/by-id/my_device_id entry. Unfortunately grub has still /dev/sdc2 configured as root partition. This means I have to guess every boot which partition-name the root partition resides. I do this by entering devices names (after the error message that grub couldn't find my root partition). I start with /dev/sda2 trying each letter (sdb2, sdc2, sdd2) until I find the root partition.

In order to solve this problem I would like to set the /dev/disk/by-id/ parameter in my grub.conf. I hope that explains the problem clearly. Thanks in advance!

Regards,

Aniruddha

#3 lore raw

2008/7/30 Aniruddha <[email protected]>:

Quoted 10 lines · Pavel Roskin
Quoted 4 lines

I believe disk IDs are not supported yet. If you describe your problem in more details, it may motivate somebody to add disk ID support. Or perhaps you are missing a simple solution possible with the current code.

Thanks for your quick response. The problem is that udev keeps changing my harddrive names at each boot. Normally my root partition resides on /dev/sdc2. However with each reboot this name changes (the last three boots it changed from /dev/sdb2 to /dev/sdf2 to /dev/sdc2).

Quoted 5 lines

I solved this partially by changing the /dev/sdc2 entry in fstab with a /dev/disk/by-id/my_device_id entry. Unfortunately grub has still /dev/sdc2 configured as root partition. This means I have to guess every boot which partition-name the root partition resides. I do this by entering devices names (after the error message that grub couldn't find my root partition). I start with /dev/sda2 trying each letter (sdb2, sdc2, sdd2) until I find the root partition.

If your problem is what device name to pass to the kernel command line, you can use a line like:
linux /vmlinuz root=UUID=diskuuidhere
and the same with LABEL= if your initrd supports them (like Ubuntu's default initrd or Gentoo's `genkernel' initrd).
If, on the other hand, your problem is what device to use in GRUB, I think there is a `search' command you can investigate.

Quoted 18 lines

In order to solve this problem I would like to set the /dev/disk/by-id/ parameter in my grub.conf. I hope that explains the problem clearly. Thanks in advance!

Regards,

Aniruddha

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

author
#4 lore raw
Quoted 8 lines · Javier Martín

If your problem is what device name to pass to the kernel command line, you can use a line like:
linux /vmlinuz root=UUID=diskuuidhere
and the same with LABEL= if your initrd supports them (like Ubuntu's default initrd or Gentoo's `genkernel' initrd).
If, on the other hand, your problem is what device to use in GRUB, I think there is a `search' command you can investigate.

If I understand you correctly I have to add the following line to my grub.conf:

Quoted 4 lines

title=Gentoo Linux (2.6.25-gentoo-r6)
root (hd0,1)
kernel /boot/kernel-genkernel-x86-2.6.25-gentoo-r6 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=LABEL=my_label udev genkernel --install --bootloader=grub --menuconfig --disklabel all

Furthermore I have to build genkernel with the "--disklabel" option to make it work right?

Quoted 1 line

genkernel --install --bootloader=grub --menuconfig --disklabel all

Thanks,

Aniruddha

#5 lore raw

2008/7/30 Aniruddha <[email protected]>:

Quoted 12 lines · Javier Martín
Quoted 9 lines

If your problem is what device name to pass to the kernel command line, you can use a line like:
linux /vmlinuz root=UUID=diskuuidhere
and the same with LABEL= if your initrd supports them (like Ubuntu's default initrd or Gentoo's `genkernel' initrd).
If, on the other hand, your problem is what device to use in GRUB, I think there is a `search' command you can investigate.

Quoted 6 lines

If I understand you correctly I have to add the following line to my grub.conf:

Quoted 3 lines

title=Gentoo Linux (2.6.25-gentoo-r6)
root (hd0,1)
kernel /boot/kernel-genkernel-x86-2.6.25-gentoo-r6 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=LABEL=my_label udev

Oh, sorry, I didn't realize you were talking about GRUB Legacy (this list is mostly about the development of GRUB 2). I think you are missing some "initrd" (GRUB2) or "module" (GRUB1?) line after the "linux" (GRUB2) or "kernel" (GRUB1) line - and the genkernel line should not be in the GRUB config files at all. The exact boot parameters and configuration should be in the Gentoo documentation: if I remember my Gentoo times correctly, the Handbook should have all the info you need. If you mail me a link to the post related to this issue in the Gentoo forums, I can answer you better than in this list.

Quoted 19 lines
Quoted 1 line

genkernel --install --bootloader=grub --menuconfig --disklabel all

Furthermore I have to build genkernel with the "--disklabel" option to make it work right?

Quoted 1 line

genkernel --install --bootloader=grub --menuconfig --disklabel all

Thanks,

Aniruddha

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

author
#6 lore raw
Quoted 10 lines · Javier Martín

Oh, sorry, I didn't realize you were talking about GRUB Legacy (this list is mostly about the development of GRUB 2). I think you are missing some "initrd" (GRUB2) or "module" (GRUB1?) line after the "linux" (GRUB2) or "kernel" (GRUB1) line - and the genkernel line should not be in the GRUB config files at all. The exact boot parameters and configuration should be in the Gentoo documentation: if I remember my Gentoo times correctly, the Handbook should have all the info you need. If you mail me a link to the post related to this issue in the Gentoo forums, I can answer you better than in this list.

I didn't realize I was running legacy grub :0. I looked in the Gentoo handbook but I didn't find anything useful:
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=10#doc_chap2

Here's the thread in the Gentoo forums with my current problem:
http://forums.gentoo.org/viewtopic-p-5167749.html#5167749

And here's a thread with some additional information:
http://forums.gentoo.org/viewtopic-t-701101-highlight-.html

Any help would be appreciated!

Regards,

Aniruddha

P.S.
Now I go and try to boot this kernel:

Quoted 4 lines

title=Gentoo Linux (2.6.24-gentoo-r8)
root (hd0,1)
kernel /boot/kernel-genkernel-x86-2.6.24-gentoo-r8 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=LABEL=/dev/disk/by-id/scsi-SATA_SAMSUNG_HD103UJS13PJ1MQ318013-part2 udev initrd /boot/initramfs-genkernel-x86-2.6.24-gentoo-r8