kernel root parameter.. dynamic?

Caporegime
Joined
18 Oct 2002
Posts
29,493
Location
Back in East London
Here is a typical line from grub:
Code:
kernel (hd0,0)/gentoo-current root=/dev/sda3

now, we are deploying the same image (inc. kernel) on multiple machines, some are IDE (hda) others SATA (sda)

Is there a way for the label provided to root= to be dynamic dependant on which drive type it is?
 
Ooo iv come across this problem too with the live cd not being cosistent to the labeling the installed system uses (leaving confusion in the fstab and grub annoyingly).

In theory, forcing everything to use the latist pata drivers makes the lable hda obsolete (so everything becomes a sda and so on) but iv not dug too well to make this consistent.

I think there are 2 main ways round this labeling problem. (well 3 but hoping it just works never really is a sucess). First one is to have a look into using the drives UID in the setup files, but that needs to be done at each machine (and im not familer in how it works, aka iv let distros just do it and try and tell me another time).

Probably the best idea would be to try and create symlink between hda and sda (or the otherway round) on install so that all drives that get registered as hda just get remapped as sda by gentoo (hopefully negating the problem of what machine its installed to).

I do wonder if theres a simpler solution though...
 
I did wonder about that.. so:

I make a symlink from /dev/hda3 to /dev/sda3
If machine has /dev/sda3 it will follow symlink
If machine has /dev/hda3 the symlink will be replaced and it'll "just work"

may give that a try
 
If you deploy the image using dd, to whatever hard drive is present, then the partition will always have the same ID. then you can have an ubuntu style fstab.

Or you could have:
Code:
/dev/hda1     /     ext3     defaults     0     2
/dev/sda1     /     ext3     defaults     0     2
in the /etc/fstab, one will fail the other will work, so long as all the machines have / on the 1st partition of the 1st disk. And no machines mix IDE and SATA/SAS/SCSI/USB storage (this means IDE or SATA is ok, but not IDE and SATA).
 
As said above if you clone the disk data then it will have the same UUID.
Hence fstab would look like:
# /dev/hda1, sda1, I don't care!
UUID=ba636202-3458-45ep-b555-da35aa659c61 / ext3 defaults,errors=remount-ro,noatime 0 1

And you could add both to grub with savedefault set. If it doesn't boot then it's just a case of rebooting and selecting the second option, which then gets saved.
 
Back
Top Bottom