LVM2 on-disk layout
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?
Signature · 1 line
Tejas Sumant
Quoted 3 lines · Tejas Sumant
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.
Quoted 1 line
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.
Quoted 2 lines
3) Why the metadata inside MDA wraps around, instead of the offset pointing to the start of metadata?
Someone else?
Signature · 4 lines
Stuart D. Gathman <[email protected]> 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.
Quoted 4 lines · Stuart D. Gathman [[email protected]] wrote:
Quoted 2 lines
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.
Quoted 2 lines · Stuart D. Gathman
Quoted 2 lines
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.
Quoted 2 lines · Tejas Sumant
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
--
[email protected]
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.
Quoted 16 lines · Tejas Sumant
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?
Signature · 7 lines
Tejas Sumant _______________________________________________ linux-lvm mailing list [email protected] https://www.redhat.com/mailman/listinfo/linux-lvm read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
Signature · 6 lines
Jayson Vantuyl Systems Architect Engine Yard [email protected] 1 866 518 9275 ext 204 IRC (freenode): kagato