All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-lvm] LVM2 on-disk layout
@ 2009-01-05 10:22 Tejas Sumant
  2009-01-05 18:49 ` Stuart D. Gathman
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Tejas Sumant @ 2009-01-05 10:22 UTC (permalink / raw)
  To: linux-lvm

I have few questions on lvm2 layout.

1) Why array of MDA (metadata area) is required? Isnt single MDA sufficient?
2) Which MDA is current?
3) Why the metadata inside MDA wraps around, instead of the offset
pointing to the start of metadata?

Can somebody kindly answers this?
-- 
Tejas Sumant

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

* Re: [linux-lvm] LVM2 on-disk layout
  2009-01-05 10:22 [linux-lvm] LVM2 on-disk layout Tejas Sumant
@ 2009-01-05 18:49 ` Stuart D. Gathman
  2009-01-05 20:08   ` malahal
  2009-01-06 10:47   ` Bryn M. Reeves
  2009-01-05 20:11 ` Jayson Vantuyl
  2009-01-05 20:14 ` Milan Broz
  2 siblings, 2 replies; 6+ messages in thread
From: Stuart D. Gathman @ 2009-01-05 18:49 UTC (permalink / raw)
  To: LVM general discussion and development

On Mon, 5 Jan 2009, Tejas Sumant wrote:

> I have few questions on lvm2 layout.
> 
> 1) Why array of MDA (metadata area) is required? Isnt single MDA sufficient?

It is not *required*, there is an option for only 1 MDA.  The extra
copies are for backup.  If main MDA gets wiped, and you don't have a backup
on a separate volume (I keep one in boot partition), then you will be glad
of the backup.

> 2) Which MDA is current?

There should be a counter in each MDA to determine most current.  Also
each MDA has a CRC to detect partial updates, and discourage manual
editing.

> 3) Why the metadata inside MDA wraps around, instead of the offset
> pointing to the start of metadata?

Someone else?

-- 
	      Stuart D. Gathman <stuart@bmsi.com>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.

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

* Re: [linux-lvm] LVM2 on-disk layout
  2009-01-05 18:49 ` Stuart D. Gathman
@ 2009-01-05 20:08   ` malahal
  2009-01-06 10:47   ` Bryn M. Reeves
  1 sibling, 0 replies; 6+ messages in thread
From: malahal @ 2009-01-05 20:08 UTC (permalink / raw)
  To: linux-lvm

Stuart D. Gathman [stuart@bmsi.com] wrote:
> > 3) Why the metadata inside MDA wraps around, instead of the offset
> > pointing to the start of metadata?
> 
> Someone else?

Probably because when something bad happens while changing the metadata,
you want to go back to the old state. To preserve the old state, you
don't want to wipe the old metadata. You need offset other than the
start of the metadata! Circular buffer is an optimal solution to
implement this, I guess.

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

* Re: [linux-lvm] LVM2 on-disk layout
  2009-01-05 10:22 [linux-lvm] LVM2 on-disk layout Tejas Sumant
  2009-01-05 18:49 ` Stuart D. Gathman
@ 2009-01-05 20:11 ` Jayson Vantuyl
  2009-01-05 20:14 ` Milan Broz
  2 siblings, 0 replies; 6+ messages in thread
From: Jayson Vantuyl @ 2009-01-05 20:11 UTC (permalink / raw)
  To: LVM general discussion and development

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

The reason the metadata wraps around is to decrease the likelihood of  
losing all your metadata if a failure happens during an update.

If you always write from the beginning of the area, then any partial  
write guarantees a complete loss.  If you always start part-way  
through, then you only lose data when your metadata approaches the  
full size of the MDA.  Since this is most likely an issue with small  
arrays (where there are few disks and you may only have 1 or 2 MDAs),  
this gives vastly greater chances of recovery.

Also, even in the event of a failure, you are likely to get the  
beginning of the new data + end the of the old data--which is more  
recoverable (by hand) than the alternatives.

It's all about increasing chances of recoverability in the event of a  
failure.

On Jan 5, 2009, at 2:22 AM, Tejas Sumant wrote:

> I have few questions on lvm2 layout.
>
> 1) Why array of MDA (metadata area) is required? Isnt single MDA  
> sufficient?
> 2) Which MDA is current?
> 3) Why the metadata inside MDA wraps around, instead of the offset
> pointing to the start of metadata?
>
> Can somebody kindly answers this?
> -- 
> Tejas Sumant
>
> _______________________________________________
> linux-lvm mailing list
> linux-lvm@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

-- 
Jayson Vantuyl
Systems Architect
Engine Yard
jvantuyl@engineyard.com
1 866 518 9275 ext 204
IRC (freenode): kagato


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

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

* Re: [linux-lvm] LVM2 on-disk layout
  2009-01-05 10:22 [linux-lvm] LVM2 on-disk layout Tejas Sumant
  2009-01-05 18:49 ` Stuart D. Gathman
  2009-01-05 20:11 ` Jayson Vantuyl
@ 2009-01-05 20:14 ` Milan Broz
  2 siblings, 0 replies; 6+ messages in thread
From: Milan Broz @ 2009-01-05 20:14 UTC (permalink / raw)
  To: LVM general discussion and development

Tejas Sumant wrote:
> 3) Why the metadata inside MDA wraps around, instead of the offset
> pointing to the start of metadata?

Metadata updates run in two steps:

- write() saves the new metadata to new place (circular buffer)
but still keeping previous version active.
(Also operation can be safely reverted here, because there
are still old version of metadata prepared.)

- commit() switch the pointer to new offset and activate
new metadata. This operation is atomic (one synchronous sector write)
so it cannot corrupt active metadata copy.
(If the write fails, old metadata are still valid.)

(Imagine for example power failure during metadata write operation.)

There is serial number in metadata, lvm will update mda content to newest
metadata if any copies are older.


Milan
--
mbroz@redhat.com

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

* Re: [linux-lvm] LVM2 on-disk layout
  2009-01-05 18:49 ` Stuart D. Gathman
  2009-01-05 20:08   ` malahal
@ 2009-01-06 10:47   ` Bryn M. Reeves
  1 sibling, 0 replies; 6+ messages in thread
From: Bryn M. Reeves @ 2009-01-06 10:47 UTC (permalink / raw)
  To: LVM general discussion and development

Stuart D. Gathman wrote:
>> 3) Why the metadata inside MDA wraps around, instead of the offset
>> pointing to the start of metadata?

It's a ring (circular) buffer.

Regards,
Bryn.

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

end of thread, other threads:[~2009-01-06 10:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-05 10:22 [linux-lvm] LVM2 on-disk layout Tejas Sumant
2009-01-05 18:49 ` Stuart D. Gathman
2009-01-05 20:08   ` malahal
2009-01-06 10:47   ` Bryn M. Reeves
2009-01-05 20:11 ` Jayson Vantuyl
2009-01-05 20:14 ` Milan Broz

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.