Appendix D. LVM Volume Group Metadata
The configuration details of a volume group are referred to as the metadata. By default, an identical copy of the metadata is maintained in every metadata area in every physical volume within the volume group. LVM volume group metadata is stored as ASCII.
A metadata area is a circular buffer. New metadata is appended to the old metadata and then the pointer to the start of it is updated.
You can specify the size of the metadata area with the
--metadatasize. option of the
pvcreatecommand. The default size may be too small for volume groups that contain physical volumes and logical volumes that number in the hundreds.
If a volume group contains many physical volumes, having many redundant copies of the metadata is inefficient. It is possible to create a physical volume without any metadata copies by using the
--metadatacopies 0option of the
pvcreatecommand. Once you have selected the number of metadata copies the physical volume will contain, you cannot change that at a later point. Selecting 0 copies can result in faster updates on configuration changes. Note, however, that at all times every volume group must contain at least one physical volume with a metadata area (unless you are using the advanced configuration settings that allow you to store volume group metadata in a file system). If you intend to split the volume group in the future, every volume group needs at least one metadata copy.
As of Red Hat Enterprise Linux 5.6, you can also control metadata storage on a physical volume by using the
--metadataignoreoption of the
pvcreatecommand. If metadata areas on a physical volume are ignored, LVM will not store metadata in the metadata areas present on this physical volume. Since metadata areas cannot be created or extended after logical volumes have been allocated on the device, it is recommended that you allocate a metadata area in case you need it in the future even if you do not want to store metadata on this device. You can then use this option to instruct LVM to ignore the metadata area.
As of Red Hat Enterprise Linux 5.6, you can determine the number of metadata copies at the volume group level with the
--vgmetadatacopiesoption of the
vgcreatecommand. For information on setting this value, see the
vgcreateman page. You may find this option useful for volume groups containing large numbers of physical volumes with metadata, as you can use the option to minimize metadata read and write overhead.
If you use the
vgsplitcommand to split a volume group, the volume group retains the existing volume groups value of
vgmetadatacopies. You can use the
vgchangecommand to change the value of
D.1. The Physical Volume Label
By default, the
pvcreatecommand places the physical volume label in the 2nd 512-byte sector. This label can optionally be placed in any of the first four sectors, since the LVM tools that scan for a physical volume label check the first 4 sectors. The physical volume label begins with the string
The physical volume label Contains:
- Physical volume UUID
- Size of block device in bytes
- NULL-terminated list of data area locations
- NULL-terminated lists of metadata area locations
Metadata locations are stored as offset and size (in bytes). There is room in the label for about 15 locations, but the LVM tools currently use 3: a single data area plus up to two metadata areas.