B.3. LVM Profiles
An LVM profile is a set of selected customizable configuration settings that can be used to achieve certain characteristics in various environments or uses. Normally, the name of the profile should reflect that environment or use. An LVM profile overrides existing configuration.
There are two groups of LVM profiles that LVM recognizes: command profiles and metadata profiles.
- A command profile is used to override selected configuration settings at the global LVM command level. The profile is applied at the beginning of LVM command execution and it is used throughout the time of the LVM command execution. You apply a command profile by specifying the
--commandprofile ProfileName
option when executing an LVM command. - A metadata profile is used to override selected configuration settings at the volume group/logical volume level. It is applied independently for each volume group/logical volume that is being processed. As such, each volume group/logical volume can store the profile name used in its metadata so that next time the volume group/logical volume is processed, the profile is applied automatically. If the volume group and any of its logical volumes have different profiles defined, the profile defined for the logical volume is preferred.
- You can attach a metadata profile to a volume group or logical volume by specifying the
--metadataprofile ProfileName
option when you create the volume group or logical volume with thevgcreate
orlvcreate
command. - You can attach or detach a metadata profile to an existing volume group or logical volume by specifying the
--metadataprofile ProfileName
or the--detachprofile
option of thelvchange
orvgchange
command. - You can specify the
-o vg_profile
and-o lv_profile
output options of thevgs
andlvs
commands to display the metadata profile currently attached to a volume group or a logical volume.
The set of options allowed for command profiles and the set of options allowed for metadata profiles are mutually exclusive. The settings that belong to either of these two sets cannot be mixed together and the LVM tools will reject such profiles.
LVM provides a few predefined configuration profiles. The LVM profiles are stored in the
/etc/lvm/profile
directory by default. This location can be changed by using the profile_dir
setting in the /etc/lvm/lvm.conf
file. Each profile configuration is stored in ProfileName.profile file in the profile
directory. When referencing the profile in an LVM command, the .profile
suffix is omitted.
You can create additional profiles with different values. For this purpose, LVM provides the
command_profile_template.profile
file (for command profiles) and the metadata_profile_template.profile
file (for metadata profiles) which contain all settings that are customizable by profiles of each type. You can copy these template profiles and edit them as needed.
Alternatively, you can use the
lvmconfig
command to generate a new profile for a given section of the profile file for either profile type. The following command creates a new command profile named ProfileName.profile consisting of the settings in section.
lvmconfig --file ProfileName.profile --type profilable-command section
The following command creates a new metadata profile named ProfileName.profile consisting of the settings in section.
lvmconfig --file ProfileName.profile --type profilable-metadata section
If the section is not specified, all profilable settings are reported.