search and boot using GPT GUID values
Hi All,
I've been experimenting with booting linux from a GPT-formatted drive on a BIOS-based x86 pc.
=== (1)
Is there a grub "search" command variant to find the (hdx,y) value for a GPT partition GUID? (I can't see one).
If not, do you think this would be a useful thing? I might be interested in trying to code this up.
Yes, search.fs_uuid can also be used; AFAICS there isn't a *huge* advantage to using partition GUID here, but it fits well with (2) below.
=== (2)
When linux is started without an initrd, the root= param supports only
* root=major:minor
* root=number where number is major<<n + minor
* root=/dev/sd{n}{p}
where n depends on the order in which linux discovers the disks, and p is the partition index.
None of these options are robust against hardware changes that change the linux disk enumeration order. When an initrd is used, then UUID/LABEL can work around this but without initrd these are not available.
So what do you think about
(a) adding root=GUID as a kernel option
(b) optionally using the search command from (1) above
so that something like the following can be done:
set ROOTGUID=ABCD1234ABCD5678
search.gpt_guid $ROOTGUID
linux /mykernel root=$ROOTGUID
It seems to me that both the grub and kernel parts are reasonably simple. The kernel just needs to be enhanced to store the GUID value on the relevant device objects as it creates them. File do_mounts.c already iterates over all devices to handle "/dev/sda1" style paths, so this can just be enhanced to check the new GUID value too. And the "guidmap" command should be really trivial.
Note that root=GUID can be implemented with just support for partition-schemes compiled in to the linux kernel (which is usual; GPT support is there by default). The GUID is just an array of 16 bytes in the partition table, and linux scans the partition tables already.
This solution also appears to be reasonably cross-platform, as GPT is a platform-independent and bootloader-independent specification.
Supporting filesystem UUID in the kernel without an initrd just isn't going to happen; it requires filesystem drivers.
===
Any thoughts?
Regards,
Simon
Quoted 2 lines · Simon Kitching
So what do you think about
(a) adding root=GUID as a kernel option
That's something you need to ask Linux folks, not GRUB folks. For non-initrd usage, it sounds plausible to me that you'd have a chance of achieving some linux-kernel-change (as long as you restrict the code-bloat to when GPT or a similar partition-table-format-with-uuids is enabled in the kernel-config). But it ought to work in common initrds too, not just non-initrd mode! (Distributors, such as Debian, I think are the people who arrange initrds currently...) So you have a few people to chase down, and ask, and possibly follow up by sending patches to, etc... good luck! Be ingenious in response to flames!
Quoted 2 lines
(b) optionally using the search command from (1) above
so that something like the following can be done:
gpt-guid has been discussed on this GRUB list quite recently -- did you see Vladmir's post?
http://www.mail-archive.com/[email protected]/msg15345.html
-Isaac
Quoted 4 lines · Isaac Dupree
Quoted 2 lines · Simon Kitching
So what do you think about
(a) adding root=GUID as a kernel option
Quoted 9 lines
That's something you need to ask Linux folks, not GRUB folks. For non-initrd usage, it sounds plausible to me that you'd have a chance of achieving some linux-kernel-change (as long as you restrict the code-bloat to when GPT or a similar partition-table-format-with-uuids is enabled in the kernel-config). But it ought to work in common initrds too, not just non-initrd mode! (Distributors, such as Debian, I think are the people who arrange initrds currently...) So you have a few people to chase down, and ask, and possibly follow up by sending patches to, etc... good luck! Be ingenious in response to flames!
Yes, I'm willing to have a go at the linux side of this (and have my flame-proof underwear ready). I just wanted to see if anyone here was going to tell me this (or some equivalent functionality) already exists, or it was a stupid idea for other reasons.
Good point about having to fix with-initrd case as well as without-initrd; it certainly would be inconsistent otherwise.
I don't expect to make *rapid* progress on this, but IMO it's worth a try.
Quoted 8 lines
Quoted 3 lines
(b) optionally using the search command from (1) above
so that something like the following can be done:gpt-guid has been discussed on this GRUB list quite recently -- did you see Vladmir's post?
http://www.mail-archive.com/[email protected]/msg15345.html
Thanks for the link; I just subscribed recently and had missed that thread. That is exactly the functionality I was looking for, and I'm glad the general concept seems to meet with support (although there were some concerns about the details of the proposed patch). I'll test George Buranov's patch and add feedback on that thread.
Regards,
Simon
Great that somebody agrees with me on the GUIDs =)
In you have problems with compile/testing, feel free to reply here (or to my mail directly). I ahave made some fixes to it.
Again, I am talking about integration it to the GRUB. This is MUST HAVE feature, at least for UEFI support
--
This message was sent on behalf of [email protected] at openSubscriber.com
http://www.opensubscriber.com/message/[email protected]/13731119.html