[linux-lvm] metadata copies

Stuart D. Gathman stuart at bmsi.com
Wed Aug 10 21:00:11 UTC 2011

On Wed, 10 Aug 2011, Milan Broz wrote:

> On 08/10/2011 06:30 PM, Jewsco Pius Jacquez wrote:
>> If you have two metadata copies stored in one PV, how does the OS know which
>> one is the legitimate copy?
> Only one metadata copy is always active.
> There is sequence ID (see seqno = X in metadata backup).
> If there are several PVs and more versions of metadata present, the one with
> highest sequence ID is used and other PVs are automatically updated to this
> version.
> Every LVM operation which changes metadata also increases this sequence id.

What happens if there are 2 or more metadata copies with the same sequence 
ID, but different contents?  Not just buggy/malicious code can cause this.
Imagine that a careless admin removes a PV, puts it on another system,
independently updates both systems for a while, then later adds the PV back to
the original system (and the seqnos match).

(Guesses - not authoritative information)

1) I believe the metadata includes a hash/checksum, so that an incomplete
copy of the metadata is easily detected.  (Another reason to have at
least 2 copies - in case of power loss during metadata update.)

2) I suspect there is no clever algorithm, and it probably uses the first
valid copy seen with the highest sequence.  AIX had a "quorum" system 
where the majority of metadata copies had to agree - or operator intervention
was required to bring the VG online.

 	      Stuart D. Gathman <stuart at 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.

More information about the linux-lvm mailing list