All of lore.kernel.org
 help / color / mirror / Atom feed
* LVM write support from grub2. Writing to environment block in core.img
@ 2009-11-10 23:29 Roger Cruz
  2009-11-11  0:18 ` Vladimir 'phcoder' Serbinenko
  0 siblings, 1 reply; 3+ messages in thread
From: Roger Cruz @ 2009-11-10 23:29 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 2274 bytes --]

Hi there developers,

I posted this message last night and I was wondering if one of you would be kind enough to make a reply as to your assessment of having an LVM write function implemented.  I am in dire need to have this capability so I'm willing to code myself if need to.  I just need to understand the pitfalls and get an idea of the amount of time and work to implement it.  I have looked at the grub_lvm_read and it appears to have all the necessary logic to decode the lvm format.  I was thinking of reusing that code and at the end of it simply do a disk->dev->write which should invoke the underlying hard disk write routine (I'm new to grub2 so this is my understanding from a quick parse of the code).

Any help is extremely appreciate it... even if it is a short message to say my idea doesn't work because...

Thanks
R.

Date: Mon, 9 Nov 2009 17:11:53 -0800 (PST)
From: Roger Cruz <roger_r_cruz@yahoo.com>
Subject: LVM write support from grub2. Writing to environment block in
    core.img

I
have a system where the boot partition is on top of an LVM.  I'm using
the loadenv module to save state and remember the previously booted
entry.  I have something like this:

if [ ${prev_saved_entry} ];
then  saved_entry=${prev_saved_entry}  save_env saved_entry 
prev_saved_entry=  save_env prev_saved_entryfi
In examining why save_env is not writing to grubenv, I came across this LVM routine that says LVM writes are not supported.
static grub_err_t
grub_lvm_write (grub_disk_t disk __attribute ((unused)),
             grub_disk_addr_t sector __attribute ((unused)),
             grub_size_t size __attribute ((unused)),
            const char *buf __attribute ((unused)))
{
  return GRUB_ERR_NOT_IMPLEMENTED_YET;
}
Is
there a plan to add this support?  Anyone currently working on it that
I may get an early implementation from?  If not, is there a technical
reason why this would be hard for someone (maybe me) to implement?

As
a work-around, I'm considering using the environment block in
core.img.  Are there routines that can be run at boot time to allow
grub to change the variables there, perhaps using the same module
(loadenv) and so it can be used as "save_env -f core.img"?  Anyone see
any reasons why I shouldn't write to that space?

Thanks
Roger

[-- Attachment #2: Type: text/html, Size: 3260 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: LVM write support from grub2. Writing to environment block in core.img
  2009-11-10 23:29 LVM write support from grub2. Writing to environment block in core.img Roger Cruz
@ 2009-11-11  0:18 ` Vladimir 'phcoder' Serbinenko
  0 siblings, 0 replies; 3+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-11-11  0:18 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 3567 bytes --]

Roger Cruz wrote:
> Hi there developers,
>
> I posted this message last night and I was wondering if one of you
> would be kind enough to make a reply as to your assessment of having
> an LVM write function implemented.  I am in dire need to have this
> capability so I'm willing to code myself if need to.  I just need to
> understand the pitfalls and get an idea of the amount of time and work
> to implement it.  I have looked at the grub_lvm_read and it appears to
> have all the necessary logic to decode the lvm format.  I was thinking
> of reusing that code and at the end of it simply do a disk->dev->write
> which should invoke the underlying hard disk write routine (I'm new to
> grub2 so this is my understanding from a quick parse of the code).
>
When writing to devices we prefer to be careful. We don't often need to
write so the writing code isn't well-tested and any bug in it can have
grave consequences. LVM is problematic because if you have multi-disk
LVM some volumes may be invisible due to BIOS limitations. I'm not
familiar with LVM but if it has checksums they need to be updated as
well or volume will become inconsistent. In one word writing to LVM is
dangerous and I would prefer bootloader with less functionality rather
than one damaging my disks. I'm not the only developper but overall
there is a relative consensus not to write if it can be avoided.
On the other hand writing to embedding zone is a good idea and with Seth
Goldberg we decided that it's best sollution for root on ZFS which has
similar problems
> Any help is extremely appreciate it... even if it is a short message
> to say my idea doesn't work because...
>
> Thanks
> R.
>
> Date: Mon, 9 Nov 2009 17:11:53 -0800 (PST)
> From: Roger Cruz <roger_r_cruz@yahoo.com <mailto:roger_r_cruz@yahoo.com>>
> Subject: LVM write support from grub2. Writing to environment block in
>     core.img
>
> I have a system where the boot partition is on top of an LVM.  I'm
> using the loadenv module to save state and remember the previously
> booted entry.  I have something like this:
>
> if [ ${prev_saved_entry} ]; then  saved_entry=${prev_saved_entry} 
> save_env saved_entry  prev_saved_entry=  save_env prev_saved_entryfi
> In examining why save_env is not writing to grubenv, I came across
> this LVM routine that says LVM writes are not supported.
> static grub_err_t
> grub_lvm_write (grub_disk_t disk __attribute ((unused)),
>              grub_disk_addr_t sector __attribute ((unused)),
>              grub_size_t size __attribute ((unused)),
>             const char *buf __attribute ((unused)))
> {
>   return GRUB_ERR_NOT_IMPLEMENTED_YET;
> }
> Is there a plan to add this support?  Anyone currently working on it
> that I may get an early implementation from?  If not, is there a
> technical reason why this would be hard for someone (maybe me) to
> implement?
>
> As a work-around, I'm considering using the environment block in
> core.img.  Are there routines that can be run at boot time to allow
> grub to change the variables there, perhaps using the same module
> (loadenv) and so it can be used as "save_env -f core.img"?  Anyone see
> any reasons why I shouldn't write to that space?
>
> Thanks
> Roger
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>   


-- 
Regards
Vladimir 'phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 293 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* LVM write support from grub2. Writing to environment block in core.img
@ 2009-11-10  1:11 Roger Cruz
  0 siblings, 0 replies; 3+ messages in thread
From: Roger Cruz @ 2009-11-10  1:11 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 1290 bytes --]

I have a system where the boot partition is on top of an LVM.  I'm using the loadenv module to save state and remember the previously booted entry.  I have something like this:

if [ ${prev_saved_entry} ]; then  saved_entry=${prev_saved_entry}  save_env saved_entry  prev_saved_entry=  save_env prev_saved_entryfi
In examining why save_env is not writing to grubenv, I came across this LVM routine that says LVM writes are not supported.
static grub_err_t
grub_lvm_write (grub_disk_t disk __attribute ((unused)),
             grub_disk_addr_t sector __attribute ((unused)),
             grub_size_t size __attribute ((unused)),
            const char *buf __attribute ((unused)))
{
  return GRUB_ERR_NOT_IMPLEMENTED_YET;
}
Is there a plan to add this support?  Anyone currently working on it that I may get an early implementation from?  If not, is there a technical reason why this would be hard for someone (maybe me) to implement?

As a work-around, I'm considering using the environment block in core.img.  Are there routines that can be run at boot time to allow grub to change the variables there, perhaps using the same module (loadenv) and so it can be used as "save_env -f core.img"?  Anyone see any reasons why I shouldn't write to that space?

Thanks
Roger



[-- Attachment #2: Type: text/html, Size: 2200 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-11  0:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-10 23:29 LVM write support from grub2. Writing to environment block in core.img Roger Cruz
2009-11-11  0:18 ` Vladimir 'phcoder' Serbinenko
  -- strict thread matches above, loose matches on Subject: below --
2009-11-10  1:11 Roger Cruz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.