[Top][All Lists]

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

Re: Finding the root device of a labeled partition

From: Simon Wydooghe
Subject: Re: Finding the root device of a labeled partition
Date: Fri, 3 Jun 2016 11:38:46 +0200

Cheers Andrei, that works perfectly! Never would have found out about the
regexp command I think.

To answer your question why I don't want to alter the bootloader location:
these USB sticks get autoprovisioned by Foreman using preseed and I prefer
to not tweak the preseed too much. Also, I want the USB sticks to be
bootable when they are not chainloaded, which I suppose would not be the
case if I were to write the bootcode to a partition instead of a device? I
might be wrong there...

So thanks very much for this, you helped me a great deal.


On Thu, Jun 2, 2016 at 7:58 PM, Andrei Borzenkov <address@hidden>

> 02.06.2016 14:34, Simon Wydooghe пишет:
> > Hi,
> >
> > I have a specific problem I'm trying to solve. I'm trying to chainload
> the
> > MBR of a USB stick based on the label of one of the partitions on the USB
> > stick. I can search and set the root partition as follows:
> >
> > search --set=root --label MYLABEL
> >
> > This sets root to 'hd1,msdos3' for instance. However, I can't chainload
> > this because I need to chainload the device (hd1), not the partition
> > (hd1,msdos3).
> >
> What's wrong with installing bootloader on partition 3?
> > So chainloader ($root)+1 will not work. Chainloader (hd1)+1 does work. So
> > my question is, how can I find the device automatically and assign it to
> a
> > variable? As this USB stick will be used on a variety of hardware, I can
> > never know in advance if it will be hd1, hd2, etc.
> >
> You can use regexp to extract drive name.
> regexp --set chain '([^,]*)(,.*|)$' $root
> chainloader ($chain)+1
> I suppose more elaborate regex is possible to account for escaped '\,',
> but I doubt we see it in practice.

reply via email to

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