grub-devel
[Top][All Lists]
Advanced

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

Re: Future of installing GRUB to LVM volumes (and loop devices)


From: Sebastian Pipping
Subject: Re: Future of installing GRUB to LVM volumes (and loop devices)
Date: Sat, 16 May 2015 16:10:21 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

On 16.05.2015 05:47, Jordan Uggla wrote:
>> The setup is a single plain partition in an LVM volume.
>>
>> The following commands reproduce the setup (in RAM if /tmp is tmpfs).
>> With a plain LVM volume, the error is the same tough.
>>
>>   # tmpfile="$(mktemp)"
>>   # echo "${tmpfile}"
>>   # truncate --size=$((100*1024**2)) "${tmpfile}"
>>   # loop_device_2="$(losetup --show -f "${tmpfile}")"
>>   # echo "${loop_device_2}"
>>   # vgcreate vg "${loop_device_2}"
>>   # lvcreate --name lv -l 100%free vg
>>   # sleep 1
>>
>>   # parted /dev/vg/lv --script mklabel msdos
>>   # parted /dev/vg/lv --script mkpart primary ext4 4m 100%
>>   # sleep 1
>>   # mkfs.ext4 /dev/mapper/vg-lv1
>>   # mkdir /mnt/lv-root
>>   # mount /dev/mapper/vg-lv1 /mnt/lv-root
>>   # mkdir /mnt/lv-root/boot
>>   # grub-install --boot-directory=/mnt/lv-root/boot /dev/mapper/vg-lv ;
> 
> That is a nonsensical grub-install command.

I do not approve of calling nonsense on me.  Don't do that.  Thanks.


> You're telling grub-install that you want grub's boot sector and
> core.img to be installed to a device that cannot possibly be accessed
> by your BIOS (unless you have a BIOS that understands LVM). It may be
> that it should be failing with a better error message, or that there
> is a better example of what should be working that isn't, but I would
> never expect this command to work. I'm not even sure what semantics
> you would expect from this command, and if it happened to do what you
> wanted it to do in the past I can only imagine that that was a "lucky"
> quirk of the implementation.

The tempfile and loop device are for (1) not messing with any
producution LVM volume group of the host system and (2) for being able
to write to work with RAM rather than wasting disk cycles.
If that looks wierd to you: it's for reproduction purposes.
As I wrote above "With a plain LVM volume, the error is the same".

For the second half, the host BIOS does not have to be able to boot from
that GRUB since I'm creating a virtual machine image here.  In the mail
starting this thread I explained:

  "I have a case where grub-install is asked to install to an
  LVM volume [1] that is later passed to Xen to boot a Xen guest.
  Inside the Xen guest the LVM volume is seen as a regular hard disk.

  [1] from inside a tool called grmldeboostrap [2], a wrapper around
      deboostrap installing Debian to a given block device"

Best,



Sebastian




reply via email to

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