help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Autodetect available OS


From: Michael Evans
Subject: Re: Autodetect available OS
Date: Tue, 22 Dec 2009 14:34:26 -0800

On Tue, Dec 22, 2009 at 7:00 AM, Sergio Tashdjian <address@hidden> wrote:
> Hi guys, sorry if this is an old topic, or a crazy question. Googling for it
> brought almost nothing interesting.
> Just want to know if its possible to let grub check for available bootable
> partitions when it starts up, and adjust the menu to include the ones that
> are even not configured in grub's config file.
> Why? mainly to allow booting from USB devices with potentially different OSs
> or partitions.  I will love to be able to connect an USB storage device,
> turn on the PC and have grub showing bootable partitions on that device.
> Probably its simpler for Windows where there is no kernel or initrd to
> specify, but even for Linux having grub searching kernels/initrds in usual
>  places of the detected partitions and provide a list of them sounds like
> something i will love to have.
> In short, i'm looking for a PlugAndBoot feature :)
> Thanks for your comments !
> Tashi.
>
>
> _______________________________________________
> Help-grub mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-grub
>
>

The way debian and ubuntu seem to use grub and grub2 is to have a
userspace program (set of scripts really but...) detect the OS in
question.  I've only heard of that failing on disks that had been in a
raid array before without having the old meta-data scrubbed off the
end of the drive (it was removed since it looked like a raid device,
but since it wasn't a valid raid device it didn't get added back in as
a raid volume).

Looking at -how- they operate can show us the depth of what you're
asking; to tell the difference between a FAT or NTFS partition used
for data alone and one that can boot the OS.  The userspace scripts in
question detect Vista/Win7 in one way, Nt2k/XP in another, and 9x/me
in yet a third way.  It also has to actually mount the FS to tell if
the correct entries are there.

Detecting Linux is even harder, there is no standard set of kernel
arguments; often custom initrds and root and/or resume partition
notations.  Every possible boot-loader's configuration area would have
to be examined and imported for grub to work.



Now, a solution that COULD work far more easily is already present
within your BIOS.  It varies from BIOS to BIOS, but generally pressing
F8 or F12 will bring up a little menu that lets you choose the boot
device; selecting the external USB HD will allow you to boot off of
it; as if it were the 'first' device (zeroth BIOS drive).  If grub
thinks the external drive is BIOS disk 0 (hd0) and is trying to load
the kernel and initrd from there that should work; if the initrd and
kernel specify devices by UUID (or even label as long as it's unique)
then THAT should work as well and the system should boot-strap.
Finally if the /etc/fstab on that drive uses label or uuid it will
work for similar reasons.

Windows is a bit more complicated; I've not experienced booting it in
odd situations lately but there is a -chance- it will start up under
that scenerio, which grub couldn't help with any more anyway.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]