Cari di RHE Linux 
    Red Hat Enterprise Linux Manual
Daftar Isi
(Sebelumnya) 10 : Chapter 7. LVM Administra ...11 : Performance Tuning Guide (Berikutnya)

The LVM Configuration Files

LVM supports multiple configuration files. At system startup, the lvm.conf configuration file is loaded from the directory specified by the environment variable LVM_SYSTEM_DIR, which is set to /etc/lvm by default.
The lvm.conf file can specify additional configuration files to load. Settings in later files override settings from earlier ones. To display the settings in use after loading all the configuration files, execute the lvm dumpconfig command.
For information on loading additional configuration files, see Section C.2, "Host Tags".

B.1. The LVM Configuration Files

The following files are used for LVM configuration:
/etc/lvm/lvm.conf
Central configuration file read by the tools.
etc/lvm/lvm_hosttag.conf
For each host tag, an extra configuration file is read if it exists: lvm_hosttag.conf. If that file defines new tags, then further configuration files will be appended to the list of tiles to read in. For information on host tags, see Section C.2, "Host Tags".
In addition to the LVM configuration files, a system running LVM includes the following files that affect LVM system setup:
/etc/lvm/cache/.cache
Device name filter cache file (configurable).
/etc/lvm/backup/
Directory for automatic volume group metadata backups (configurable).
/etc/lvm/archive/
Directory for automatic volume group metadata archives (configurable with regard to directory path and archive history depth).
/var/lock/lvm/
In single-host configuration, lock files to prevent parallel tool runs from corrupting the metadata; in a cluster, cluster-wide DLM is used.

B.2. Sample lvm.conf File

The following is a sample lvm.conf configuration file. Your configuration file may differ slightly from this one.
# This is an example configuration file for the LVM2 system.# It contains the default settings that would be used if there was no# /etc/lvm/lvm.conf file.## Refer to 'man lvm.conf' for further information including the file layout.## To put this file in a different directory and override /etc/lvm set# the environment variable LVM_SYSTEM_DIR before running the tools.## N.B. Take care that each setting only appears once if uncommenting# example settings in this file.# This section allows you to configure which block devices should# be used by the LVM system.devices { # Where do you want your volume groups to appear ? dir = "/dev" # An array of directories that contain the device nodes you wish # to use with LVM2. scan = [ "/dev" ] # If set, the cache of block device nodes with all associated symlinks # will be constructed out of the existing udev database content. # This avoids using and opening any inapplicable non-block devices or # subdirectories found in the device directory. This setting is applied # to udev-managed device directory only, other directories will be scanned # fully. LVM2 needs to be compiled with udev support for this setting to # take effect. N.B. Any device node or symlink not managed by udev in # udev directory will be ignored with this setting on. obtain_device_list_from_udev = 1 # If several entries in the scanned directories correspond to the # same block device and the tools need to display a name for device, # all the pathnames are matched against each item in the following # list of regular expressions in turn and the first match is used. # preferred_names = [ ] # Try to avoid using undescriptive /dev/dm-N names, if present. preferred_names = [ "^/dev/mpath/", "^/dev/mapper/mpath", "^/dev/[hs]d" ] # A filter that tells LVM2 to only use a restricted set of devices. # The filter consists of an array of regular expressions.  These # expressions can be delimited by a character of your choice, and # prefixed with either an 'a' (for accept) or 'r' (for reject). # The first expression found to match a device name determines if # the device will be accepted or rejected (ignored).  Devices that # don't match any patterns are accepted. # Be careful if there there are symbolic links or multiple filesystem # entries for the same device as each name is checked separately against # the list of patterns.  The effect is that if the first pattern in the # list to match a name is an 'a' pattern for any of the names, the device # is accepted; otherwise if the first pattern in the list to match a name # is an 'r' pattern for any of the names it is rejected; otherwise it is # accepted. # Don't have more than one filter line active at once: only one gets used. # Run vgscan after you change this parameter to ensure that # the cache file gets regenerated (see below). # If it doesn't do what you expect, check the output of 'vgscan -vvvv'. # By default we accept every block device: filter = [ "a/.*/" ] # Exclude the cdrom drive # filter = [ "r|/dev/cdrom|" ] # When testing I like to work with just loopback devices: # filter = [ "a/loop/", "r/.*/" ] # Or maybe all loops and ide drives except hdc: # filter =[ "a|loop|", "r|/dev/hdc|", "a|/dev/ide|", "r|.*|" ] # Use anchors if you want to be really specific # filter = [ "a|^/dev/hda8$|", "r/.*/" ] # Since "filter" is often overriden from command line, it is not suitable # for system-wide device filtering (udev rules, lvmetad). To hide devices # from LVM-specific udev processing and/or from lvmetad, you need to set # global_filter. The syntax is the same as for normal "filter" # above. Devices that fail the global_filter are not even opened by LVM. # global_filter = [] # The results of the filtering are cached on disk to avoid # rescanning dud devices (which can take a very long time). # By default this cache is stored in the /etc/lvm/cache directory # in a file called '.cache'. # It is safe to delete the contents: the tools regenerate it. # (The old setting 'cache' is still respected if neither of # these new ones is present.) # N.B. If obtain_device_list_from_udev is set to 1 the list of # devices is instead obtained from udev and any existing .cache # file is removed. cache_dir = "/etc/lvm/cache" cache_file_prefix = "" # You can turn off writing this cache file by setting this to 0. write_cache_state = 1 # Advanced settings. # List of pairs of additional acceptable block device types found # in /proc/devices with maximum (non-zero) number of partitions. # types = [ "fd", 16 ] # If sysfs is mounted (2.6 kernels) restrict device scanning to # the block devices it believes are valid. # 1 enables; 0 disables. sysfs_scan = 1 # By default, LVM2 will ignore devices used as component paths # of device-mapper multipath devices. # 1 enables; 0 disables. multipath_component_detection = 1 # By default, LVM2 will ignore devices used as components of # software RAID (md) devices by looking for md superblocks. # 1 enables; 0 disables. md_component_detection = 1 # By default, if a PV is placed directly upon an md device, LVM2 # will align its data blocks with the md device's stripe-width. # 1 enables; 0 disables. md_chunk_alignment = 1 # Default alignment of the start of a data area in MB.  If set to 0, # a value of 64KB will be used.  Set to 1 for 1MiB, 2 for 2MiB, etc. # default_data_alignment = 1 # By default, the start of a PV's data area will be a multiple of # the 'minimum_io_size' or 'optimal_io_size' exposed in sysfs. # - minimum_io_size - the smallest request the device can perform #   w/o incurring a read-modify-write penalty (e.g. MD's chunk size) # - optimal_io_size - the device's preferred unit of receiving I/O #   (e.g. MD's stripe width) # minimum_io_size is used if optimal_io_size is undefined (0). # If md_chunk_alignment is enabled, that detects the optimal_io_size. # This setting takes precedence over md_chunk_alignment. # 1 enables; 0 disables. data_alignment_detection = 1 # Alignment (in KB) of start of data area when creating a new PV. # md_chunk_alignment and data_alignment_detection are disabled if set. # Set to 0 for the default alignment (see: data_alignment_default) # or page size, if larger. data_alignment = 0 # By default, the start of the PV's aligned data area will be shifted by # the 'alignment_offset' exposed in sysfs.  This offset is often 0 but # may be non-zero; e.g.: certain 4KB sector drives that compensate for # windows partitioning will have an alignment_offset of 3584 bytes # (sector 7 is the lowest aligned logical block, the 4KB sectors start # at LBA -1, and consequently sector 63 is aligned on a 4KB boundary). # But note that pvcreate --dataalignmentoffset will skip this detection. # 1 enables; 0 disables. data_alignment_offset_detection = 1 # If, while scanning the system for PVs, LVM2 encounters a device-mapper # device that has its I/O suspended, it waits for it to become accessible. # Set this to 1 to skip such devices.  This should only be needed # in recovery situations. ignore_suspended_devices = 0 # During each LVM operation errors received from each device are counted. # If the counter of a particular device exceeds the limit set here, no # further I/O is sent to that device for the remainder of the respective # operation. Setting the parameter to 0 disables the counters altogether. disable_after_error_count = 0 # Allow use of pvcreate --uuid without requiring --restorefile. require_restorefile_with_uuid = 1 # Minimum size (in KB) of block devices which can be used as PVs. # In a clustered environment all nodes must use the same value. # Any value smaller than 512KB is ignored. # Ignore devices smaller than 2MB such as floppy drives. pv_min_size = 2048 # The original built-in setting was 512 up to and including version 2.02.84. # pv_min_size = 512 # Issue discards to a logical volumes's underlying physical volume(s) when # the logical volume is no longer using the physical volumes' space (e.g. # lvremove, lvreduce, etc).  Discards inform the storage that a region is # no longer in use.  Storage that supports discards advertise the protocol # specific way discards should be issued by the kernel (TRIM, UNMAP, or # WRITE SAME with UNMAP bit set).  Not all storage will support or benefit # from discards but SSDs and thinly provisioned LUNs generally do.  If set # to 1, discards will only be issued if both the storage and kernel provide # support. # 1 enables; 0 disables. issue_discards = 0}# This section allows you to configure the way in which LVM selects# free space for its Logical Volumes.allocation { # When searching for free space to extend an LV, the "cling" # allocation policy will choose space on the same PVs as the last # segment of the existing LV.  If there is insufficient space and a # list of tags is defined here, it will check whether any of them are # attached to the PVs concerned and then seek to match those PV tags # between existing extents and new extents. # Use the special tag "@*" as a wildcard to match any PV tag. # Example: LVs are mirrored between two sites within a single VG. # PVs are tagged with either @site1 or @site2 to indicate where # they are situated. # cling_tag_list = [ "@site1", "@site2" ] # cling_tag_list = [ "@*" ] # Changes made in version 2.02.85 extended the reach of the 'cling' # policies to detect more situations where data can be grouped # onto the same disks.  Set this to 0 to revert to the previous # algorithm. maximise_cling = 1 # Set to 1 to guarantee that mirror logs will always be placed on # different PVs from the mirror images.  This was the default # until version 2.02.85. mirror_logs_require_separate_pvs = 0 # Set to 1 to guarantee that thin pool metadata will always # be placed on different PVs from the pool data. thin_pool_metadata_require_separate_pvs = 0}# This section that allows you to configure the nature of the# information that LVM2 reports.log { # Controls the messages sent to stdout or stderr. # There are three levels of verbosity, 3 being the most verbose. verbose = 0 # Set to 1 to suppress all non-essential messages from stdout. # This has the same effect as -qq. # When this is set, the following commands still produce output: # dumpconfig, lvdisplay, lvmdiskscan, lvs, pvck, pvdisplay, # pvs, version, vgcfgrestore -l, vgdisplay, vgs. # Non-essential messages are shifted from log level 4 to log level 5 # for syslog and lvm2_log_fn purposes. # Any 'yes' or 'no' questions not overridden by other arguments # are suppressed and default to 'no'. silent = 0 # Should we send log messages through syslog? # 1 is yes; 0 is no. syslog = 1 # Should we log error and debug messages to a file? # By default there is no log file. #file = "/var/log/lvm2.log" # Should we overwrite the log file each time the program is run? # By default we append. overwrite = 0 # What level of log messages should we send to the log file and/or syslog? # There are 6 syslog-like log levels currently in use - 2 to 7 inclusive. # 7 is the most verbose (LOG_DEBUG). level = 0 # Format of output messages # Whether or not (1 or 0) to indent messages according to their severity indent = 1 # Whether or not (1 or 0) to display the command name on each line output command_names = 0 # A prefix to use before the message text (but after the command name, # if selected).  Default is two spaces, so you can see/grep the severity # of each message. prefix = "  " # To make the messages look similar to the original LVM tools use: #   indent = 0 #   command_names = 1 #   prefix = " -- " # Set this if you want log messages during activation. # Don't use this in low memory situations (can deadlock). # activation = 0}# Configuration of metadata backups and archiving.  In LVM2 when we# talk about a 'backup' we mean making a copy of the metadata for the# *current* system.  The 'archive' contains old metadata configurations.# Backups are stored in a human readeable text format.backup { # Should we maintain a backup of the current metadata configuration ? # Use 1 for Yes; 0 for No. # Think very hard before turning this off! backup = 1 # Where shall we keep it ? # Remember to back up this directory regularly! backup_dir = "/etc/lvm/backup" # Should we maintain an archive of old metadata configurations. # Use 1 for Yes; 0 for No. # On by default.  Think very hard before turning this off. archive = 1 # Where should archived files go ? # Remember to back up this directory regularly! archive_dir = "/etc/lvm/archive" # What is the minimum number of archive files you wish to keep ? retain_min = 10 # What is the minimum time you wish to keep an archive file for ? retain_days = 30}# Settings for the running LVM2 in shell (readline) mode.shell { # Number of lines of history to store in ~/.lvm_history history_size = 100}# Miscellaneous global LVM2 settingsglobal { # The file creation mask for any files and directories created. # Interpreted as octal if the first digit is zero. umask = 077 # Allow other users to read the files #umask = 022 # Enabling test mode means that no changes to the on disk metadata # will be made.  Equivalent to having the -t option on every # command.  Defaults to off. test = 0 # Default value for --units argument units = "h" # Since version 2.02.54, the tools distinguish between powers of # 1024 bytes (e.g. KiB, MiB, GiB) and powers of 1000 bytes (e.g. # KB, MB, GB). # If you have scripts that depend on the old behaviour, set this to 0 # temporarily until you update them. si_unit_consistency = 1 # Whether or not to communicate with the kernel device-mapper. # Set to 0 if you want to use the tools to manipulate LVM metadata # without activating any logical volumes. # If the device-mapper kernel driver is not present in your kernel # setting this to 0 should suppress the error messages. activation = 1 # If we can't communicate with device-mapper, should we try running # the LVM1 tools? # This option only applies to 2.4 kernels and is provided to help you # switch between device-mapper kernels and LVM1 kernels. # The LVM1 tools need to be installed with .lvm1 suffices # e.g. vgscan.lvm1 and they will stop working after you start using # the new lvm2 on-disk metadata format. # The default value is set when the tools are built. # fallback_to_lvm1 = 0 # The default metadata format that commands should use - "lvm1" or "lvm2". # The command line override is -M1 or -M2. # Defaults to "lvm2". # format = "lvm2" # Location of proc filesystem proc = "/proc" # Type of locking to use. Defaults to local file-based locking (1). # Turn locking off by setting to 0 (dangerous: risks metadata corruption # if LVM2 commands get run concurrently). # Type 2 uses the external shared library locking_library. # Type 3 uses built-in clustered locking. # Type 4 uses read-only locking which forbids any operations that might # change metadata. locking_type = 1 # Set to 0 to fail when a lock request cannot be satisfied immediately. wait_for_locks = 1 # If using external locking (type 2) and initialisation fails, # with this set to 1 an attempt will be made to use the built-in # clustered locking. # If you are using a customised locking_library you should set this to 0. fallback_to_clustered_locking = 1 # If an attempt to initialise type 2 or type 3 locking failed, perhaps # because cluster components such as clvmd are not running, with this set # to 1 an attempt will be made to use local file-based locking (type 1). # If this succeeds, only commands against local volume groups will proceed. # Volume Groups marked as clustered will be ignored. fallback_to_local_locking = 1 # Local non-LV directory that holds file-based locks while commands are # in progress.  A directory like /tmp that may get wiped on reboot is OK. locking_dir = "/var/lock/lvm" # Whenever there are competing read-only and read-write access requests for # a volume group's metadata, instead of always granting the read-only # requests immediately, delay them to allow the read-write requests to be # serviced.  Without this setting, write access may be stalled by a high # volume of read-only requests. # NB. This option only affects locking_type = 1 viz. local file-based # locking. prioritise_write_locks = 1 # Other entries can go here to allow you to load shared libraries # e.g. if support for LVM1 metadata was compiled as a shared library use #   format_libraries = "liblvm2format1.so" # Full pathnames can be given. # Search this directory first for shared libraries. #   library_dir = "/lib" # The external locking library to load if locking_type is set to 2. #   locking_library = "liblvm2clusterlock.so" # Treat any internal errors as fatal errors, aborting the process that # encountered the internal error. Please only enable for debugging. abort_on_internal_errors = 0 # Check whether CRC is matching when parsed VG is used multiple times. # This is useful to catch unexpected internal cached volume group # structure modification. Please only enable for debugging. detect_internal_vg_cache_corruption = 0 # If set to 1, no operations that change on-disk metadata will be permitted. # Additionally, read-only commands that encounter metadata in need of repair # will still be allowed to proceed exactly as if the repair had been # performed (except for the unchanged vg_seqno). # Inappropriate use could mess up your system, so seek advice first! metadata_read_only = 0 # 'mirror_segtype_default' defines which segtype will be used when the # shorthand '-m' option is used for mirroring.  The possible options are: # # "mirror" - The original RAID1 implementation provided by LVM2/DM.  It is #  characterized by a flexible log solution (core, disk, mirrored) # and by the necessity to block I/O while reconfiguring in the # event of a failure. # # There is an inherent race in the dmeventd failure handling # logic with snapshots of devices using this type of RAID1 that # in the worst case could cause a deadlock. #   Ref: https://bugzilla.redhat.com/show_bug.cgi?id=817130#c10 # # "raid1"  - This implementation leverages MD's RAID1 personality through # device-mapper.  It is characterized by a lack of log options. # (A log is always allocated for every device and they are placed # on the same device as the image - no separate devices are # required.)  This mirror implementation does not require I/O # to be blocked in the kernel in the event of a failure. # This mirror implementation is not cluster-aware and cannot be # used in a shared (active/active) fashion in a cluster. # # Specify the '--type <mirror|raid1>' option to override this default # setting. mirror_segtype_default = "mirror" # The default format for displaying LV names in lvdisplay was changed # in version 2.02.89 to show the LV name and path separately. # Previously this was always shown as /dev/vgname/lvname even when that # was never a valid path in the /dev filesystem. # Set to 1 to reinstate the previous format. # # lvdisplay_shows_full_device_path = 0 # Whether to use (trust) a running instance of lvmetad. If this is set to # 0, all commands fall back to the usual scanning mechanisms. When set to 1 # *and* when lvmetad is running (it is not auto-started), the volume group # metadata and PV state flags are obtained from the lvmetad instance and no # scanning is done by the individual commands. In a setup with lvmetad, # lvmetad udev rules *must* be set up for LVM to work correctly. Without # proper udev rules, all changes in block device configuration will be # *ignored* until a manual 'pvscan --cache' is performed. # # If lvmetad has been running while use_lvmetad was 0, it MUST be stopped # before changing use_lvmetad to 1 and started again afterwards. use_lvmetad = 0 # Full path of the utility called to check that a thin metadata device # is in a state that allows it to be used. # Each time a thin pool needs to be activated or after it is deactivated # this utility is executed. The activation will only proceed if the utility # has an exit status of 0. # Set to "" to skip this check.  (Not recommended.) # The thin tools are available as part of the device-mapper-persistent-data # package from https://github.com/jthornber/thin-provisioning-tools. # thin_check_executable = "/usr/sbin/thin_check" # String with options passed with thin_check command. By default, # option '-q' is for quiet output. thin_check_options = [ "-q" ]}activation { # Set to 1 to perform internal checks on the operations issued to # libdevmapper.  Useful for debugging problems with activation. # Some of the checks may be expensive, so it's best to use this # only when there seems to be a problem. checks = 0 # Set to 0 to disable udev synchronisation (if compiled into the binaries). # Processes will not wait for notification from udev. # They will continue irrespective of any possible udev processing # in the background.  You should only use this if udev is not running # or has rules that ignore the devices LVM2 creates. # The command line argument --nodevsync takes precedence over this setting. # If set to 1 when udev is not running, and there are LVM2 processes # waiting for udev, run 'dmsetup udevcomplete_all' manually to wake them up. udev_sync = 1 # Set to 0 to disable the udev rules installed by LVM2 (if built with # --enable-udev_rules). LVM2 will then manage the /dev nodes and symlinks # for active logical volumes directly itself. # N.B. Manual intervention may be required if this setting is changed # while any logical volumes are active. udev_rules = 1 # Set to 1 for LVM2 to verify operations performed by udev. This turns on # additional checks (and if necessary, repairs) on entries in the device # directory after udev has completed processing its events. # Useful for diagnosing problems with LVM2/udev interactions. verify_udev_operations = 0 # If set to 1 and if deactivation of an LV fails, perhaps because # a process run from a quick udev rule temporarily opened the device, # retry the operation for a few seconds before failing. retry_deactivation = 1 # How to fill in missing stripes if activating an incomplete volume. # Using "error" will make inaccessible parts of the device return # I/O errors on access.  You can instead use a device path, in which # case, that device will be used to in place of missing stripes. # But note that using anything other than "error" with mirrored # or snapshotted volumes is likely to result in data corruption. missing_stripe_filler = "error" # The linear target is an optimised version of the striped target # that only handles a single stripe.  Set this to 0 to disable this # optimisation and always use the striped target. use_linear_target = 1 # How much stack (in KB) to reserve for use while devices suspended # Prior to version 2.02.89 this used to be set to 256KB reserved_stack = 64 # How much memory (in KB) to reserve for use while devices suspended reserved_memory = 8192 # Nice value used while devices suspended process_priority = -18 # If volume_list is defined, each LV is only activated if there is a # match against the list. #   "vgname" and "vgname/lvname" are matched exactly. #   "@tag" matches any tag set in the LV or VG. #   "@*" matches if any tag defined on the host is also set in the LV or VG # # volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ] # If auto_activation_volume_list is defined, each LV that is to be # activated is checked against the list while using the autoactivation # option (--activate ay/-a ay), and if it matches, it is activated. #   "vgname" and "vgname/lvname" are matched exactly. #   "@tag" matches any tag set in the LV or VG. #   "@*" matches if any tag defined on the host is also set in the LV or VG # # auto_activation_volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ] # If read_only_volume_list is defined, each LV that is to be activated # is checked against the list, and if it matches, it as activated # in read-only mode.  (This overrides '--permission rw' stored in the # metadata.) #   "vgname" and "vgname/lvname" are matched exactly. #   "@tag" matches any tag set in the LV or VG. #   "@*" matches if any tag defined on the host is also set in the LV or VG # # read_only_volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ] # Size (in KB) of each copy operation when mirroring mirror_region_size = 512 # Setting to use when there is no readahead value stored in the metadata. # # "none" - Disable readahead. # "auto" - Use default value chosen by kernel. readahead = "auto" # 'raid_fault_policy' defines how a device failure in a RAID logical # volume is handled.  This includes logical volumes that have the following # segment types: raid1, raid4, raid5*, and raid6*. # # In the event of a failure, the following policies will determine what # actions are performed during the automated response to failures (when # dmeventd is monitoring the RAID logical volume) and when 'lvconvert' is # called manually with the options '--repair' and '--use-policies'. # # "warn"- Use the system log to warn the user that a device in the RAID #   logical volume has failed.  It is left to the user to run #  'lvconvert --repair' manually to remove or replace the failed #  device.  As long as the number of failed devices does not #  exceed the redundancy of the logical volume (1 device for #  raid4/5, 2 for raid6, etc) the logical volume will remain #  usable. # # "allocate" - Attempt to use any extra physical volumes in the volume #   group as spares and replace faulty devices. # raid_fault_policy = "warn" # 'mirror_image_fault_policy' and 'mirror_log_fault_policy' define # how a device failure affecting a mirror (of "mirror" segment type) is # handled.  A mirror is composed of mirror images (copies) and a log. # A disk log ensures that a mirror does not need to be re-synced # (all copies made the same) every time a machine reboots or crashes. # # In the event of a failure, the specified policy will be used to determine # what happens. This applies to automatic repairs (when the mirror is being # monitored by dmeventd) and to manual lvconvert --repair when # --use-policies is given. # # "remove" - Simply remove the faulty device and run without it.  If # the log device fails, the mirror would convert to using # an in-memory log.  This means the mirror will not # remember its sync status across crashes/reboots and # the entire mirror will be re-synced.  If a # mirror image fails, the mirror will convert to a # non-mirrored device if there is only one remaining good # copy. # # "allocate" - Remove the faulty device and try to allocate space on # a new device to be a replacement for the failed device. # Using this policy for the log is fast and maintains the # ability to remember sync state through crashes/reboots. # Using this policy for a mirror device is slow, as it # requires the mirror to resynchronize the devices, but it # will preserve the mirror characteristic of the device. # This policy acts like "remove" if no suitable device and # space can be allocated for the replacement. # # "allocate_anywhere" - Not yet implemented. Useful to place the log device # temporarily on same physical volume as one of the mirror # images. This policy is not recommended for mirror devices # since it would break the redundant nature of the mirror. This # policy acts like "remove" if no suitable device and space can # be allocated for the replacement. mirror_log_fault_policy = "allocate" mirror_image_fault_policy = "remove" # 'snapshot_autoextend_threshold' and 'snapshot_autoextend_percent' define # how to handle automatic snapshot extension. The former defines when the # snapshot should be extended: when its space usage exceeds this many # percent. The latter defines how much extra space should be allocated for # the snapshot, in percent of its current size. # # For example, if you set snapshot_autoextend_threshold to 70 and # snapshot_autoextend_percent to 20, whenever a snapshot exceeds 70% usage, # it will be extended by another 20%. For a 1G snapshot, using up 700M will # trigger a resize to 1.2G. When the usage exceeds 840M, the snapshot will # be extended to 1.44G, and so on. # # Setting snapshot_autoextend_threshold to 100 disables automatic # extensions. The minimum value is 50 (A setting below 50 will be treated # as 50). snapshot_autoextend_threshold = 100 snapshot_autoextend_percent = 20 # 'thin_pool_autoextend_threshold' and 'thin_pool_autoextend_percent' define # how to handle automatic pool extension. The former defines when the # pool should be extended: when its space usage exceeds this many # percent. The latter defines how much extra space should be allocated for # the pool, in percent of its current size. # # For example, if you set thin_pool_autoextend_threshold to 70 and # thin_pool_autoextend_percent to 20, whenever a pool exceeds 70% usage, # it will be extended by another 20%. For a 1G pool, using up 700M will # trigger a resize to 1.2G. When the usage exceeds 840M, the pool will # be extended to 1.44G, and so on. # # Setting thin_pool_autoextend_threshold to 100 disables automatic # extensions. The minimum value is 50 (A setting below 50 will be treated # as 50). thin_pool_autoextend_threshold = 100 thin_pool_autoextend_percent = 20 # While activating devices, I/O to devices being (re)configured is # suspended, and as a precaution against deadlocks, LVM2 needs to pin # any memory it is using so it is not paged out.  Groups of pages that # are known not to be accessed during activation need not be pinned # into memory.  Each string listed in this setting is compared against # each line in /proc/self/maps, and the pages corresponding to any # lines that match are not pinned.  On some systems locale-archive was # found to make up over 80% of the memory used by the process. # mlock_filter = [ "locale/locale-archive", "gconv/gconv-modules.cache" ] # Set to 1 to revert to the default behaviour prior to version 2.02.62 # which used mlockall() to pin the whole process's memory while activating # devices. use_mlockall = 0 # Monitoring is enabled by default when activating logical volumes. # Set to 0 to disable monitoring or use the --ignoremonitoring option. monitoring = 1 # When pvmove or lvconvert must wait for the kernel to finish # synchronising or merging data, they check and report progress # at intervals of this number of seconds.  The default is 15 seconds. # If this is set to 0 and there is only one thing to wait for, there # are no progress reports, but the process is awoken immediately the # operation is complete. polling_interval = 15}##################### Advanced section ###################### Metadata settings## metadata { # Default number of copies of metadata to hold on each PV.  0, 1 or 2. # You might want to override it from the command line with 0 # when running pvcreate on new PVs which are to be added to large VGs. # pvmetadatacopies = 1 # Default number of copies of metadata to maintain for each VG. # If set to a non-zero value, LVM automatically chooses which of # the available metadata areas to use to achieve the requested # number of copies of the VG metadata.  If you set a value larger # than the the total number of metadata areas available then # metadata is stored in them all. # The default value of 0 ("unmanaged") disables this automatic # management and allows you to control which metadata areas # are used at the individual PV level using 'pvchange # --metadataignore y/n'. # vgmetadatacopies = 0 # Approximate default size of on-disk metadata areas in sectors. # You should increase this if you have large volume groups or # you want to retain a large on-disk history of your metadata changes. # pvmetadatasize = 255 # List of directories holding live copies of text format metadata. # These directories must not be on logical volumes! # It's possible to use LVM2 with a couple of directories here, # preferably on different (non-LV) filesystems, and with no other # on-disk metadata (pvmetadatacopies = 0). Or this can be in # addition to on-disk metadata areas. # The feature was originally added to simplify testing and is not # supported under low memory situations - the machine could lock up. # # Never edit any files in these directories by hand unless you # you are absolutely sure you know what you are doing! Use # the supplied toolset to make changes (e.g. vgcfgrestore). # dirs = [ "/etc/lvm/metadata", "/mnt/disk2/lvm/metadata2" ]#}# Event daemon#dmeventd { # mirror_library is the library used when monitoring a mirror device. # # "libdevmapper-event-lvm2mirror.so" attempts to recover from # failures.  It removes failed devices from a volume group and # reconfigures a mirror as necessary. If no mirror library is # provided, mirrors are not monitored through dmeventd. mirror_library = "libdevmapper-event-lvm2mirror.so" # snapshot_library is the library used when monitoring a snapshot device. # # "libdevmapper-event-lvm2snapshot.so" monitors the filling of # snapshots and emits a warning through syslog when the use of # the snapshot exceeds 80%. The warning is repeated when 85%, 90% and # 95% of the snapshot is filled. snapshot_library = "libdevmapper-event-lvm2snapshot.so" # thin_library is the library used when monitoring a thin device. # # "libdevmapper-event-lvm2thin.so" monitors the filling of # pool and emits a warning through syslog when the use of # the pool exceeds 80%. The warning is repeated when 85%, 90% and # 95% of the pool is filled. thin_library = "libdevmapper-event-lvm2thin.so" # Full path of the dmeventd binary. # # executable = "/sbin/dmeventd"}

LVM Object Tags

An LVM tag is a word that can be used to group LVM2 objects of the same type together. Tags can be attached to objects such as physical volumes, volume groups, and logical volumes. Tags can be attached to hosts in a cluster configuration. Snapshots cannot be tagged.
Tags can be given on the command line in place of PV, VG or LV arguments. Tags should be prefixed with @ to avoid ambiguity. Each tag is expanded by replacing it with all objects possessing that tag which are of the type expected by its position on the command line.
As of the Red Hat Enterprise Linux 6.1 release, LVM tags are strings of up to 1024 characters (for earlier releases the upper length limit was 128 characters). LVM tags cannot start with a hyphen.
A valid tag can consist of a limited range of characters only. For the Red Hat Enterprise Linux 6.0 release, the allowed characters are [A-Za-z0-9_+.-]. As of the Red Hat Enterprise Linux 6.1 release, the list of allowed characters has been extended, and tags can contain the "/", "=", "!", ":", "#", and "&" characters.
Only objects in a volume group can be tagged. Physical volumes lose their tags if they are removed from a volume group; this is because tags are stored as part of the volume group metadata and that is deleted when a physical volume is removed. Snapshots cannot be tagged.
The following command lists all the logical volumes with the database tag.
lvs @database

C.1. Adding and Removing Object Tags

To add or delete tags from physical volumes, use the --addtag or --deltag option of the pvchange command.
To add or delete tags from volume groups, use the --addtag or --deltag option of the vgchange or vgcreate commands.
To add or delete tags from logical volumes, use the --addtag or --deltag option of the lvchange or lvcreate commands.
As of the Red Hat Enterprise Linux 6.1 release, you can specify multiple --addtag and --deltag arguments within a single pvchange, vgchange, or lvchange command. For example, the following command deletes the tags T9 and T10 and adds the tags T13 and T14 to the volume group grant.
vgchange --deltag T9 --deltag T10 --addtag T13 --addtag T14 grant

C.2. Host Tags

In a cluster configuration, you can define host tags in the configuration files. If you set hosttags = 1 in the tags section, a host tag is automatically defined using the machine's hostname. This allow you to use a common configuration file which can be replicated on all your machines so they hold identical copies of the file, but the behavior can differ between machines according to the hostname.
For information on the configuration files, see Appendix B, The LVM Configuration Files.
For each host tag, an extra configuration file is read if it exists: lvm_hosttag.conf. If that file defines new tags, then further configuration files will be appended to the list of files to read in.
For example, the following entry in the configuration file always defines tag1, and defines tag2 if the hostname is host1.
tags { tag1 { }  tag2 { host_list = ["host1"] } }

C.3. Controlling Activation with Tags

You can specify in the configuration file that only certain logical volumes should be activated on that host. For example, the following entry acts as a filter for activation requests (such as vgchange -ay) and only activates vg1/lvol0 and any logical volumes or volume groups with the database tag in the metadata on that host.
activation { volume_list = ["vg1/lvol0", "@database" ] }
There is a special match "@*" that causes a match only if any metadata tag matches any host tag on that machine.
As another example, consider a situation where every machine in the cluster has the following entry in the configuration file:
tags { hosttags = 1 }
If you want to activate vg1/lvol2 only on host db2, do the following:
  1. Run lvchange --addtag @db2 vg1/lvol2 from any host in the cluster.
  2. Run lvchange -ay vg1/lvol2.
This solution involves storing hostnames inside the volume group metadata.

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.
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 0 option of the pvcreate command. 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.
The core metadata is stored in 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 metadata area with the --metadatasize. option of the pvcreate command. The default size may be too small for volume groups that contain physical volumes and logical volumes that number in the hundreds.

D.1. The Physical Volume Label

By default, the pvcreate command 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 LABELONE.
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.

D.2. Metadata Contents

The volume group metadata contains:
  • Information about how and when it was created
  • Information about the volume group:
The volume group information contains:
  • Name and unique id
  • A version number which is incremented whenever the metadata gets updated
  • Any properties: Read/Write? Resizeable?
  • Any administrative limit on the number of physical volumes and logical volumes it may contain
  • The extent size (in units of sectors which are defined as 512 bytes)
  • An unordered list of physical volumes making up the volume group, each with:
    • Its UUID, used to determine the block device containing it
    • Any properties, such as whether the physical volume is allocatable
    • The offset to the start of the first extent within the physical volume (in sectors)
    • The number of extents
  • An unordered list of logical volumes. each consisting of
    • An ordered list of logical volume segments. For each segment the metadata includes a mapping applied to an ordered list of physical volume segments or logical volume segments

D.3. Sample Metadata

The following shows an example of LVM volume group metadata for a volume group called myvg.
# Generated by LVM2: Tue Jan 30 16:28:15 2007contents = "Text Format Volume Group"version = 1description = "Created *before* executing 'lvextend -L+5G /dev/myvg/mylv /dev/sdc'"creation_host = "tng3-1" # Linux tng3-1 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:21 EST 2007 i686creation_time = 1170196095  # Tue Jan 30 16:28:15 2007myvg { id = "0zd3UT-wbYT-lDHq-lMPs-EjoE-0o18-wL28X4" seqno = 3 status = ["RESIZEABLE", "READ", "WRITE"] extent_size = 8192  # 4 Megabytes max_lv = 0 max_pv = 0 physical_volumes { pv0 { id = "ZBW5qW-dXF2-0bGw-ZCad-2RlV-phwu-1c1RFt" device = "/dev/sda" # Hint only status = ["ALLOCATABLE"] dev_size = 35964301 # 17.1491 Gigabytes pe_start = 384 pe_count = 4390 # 17.1484 Gigabytes } pv1 { id = "ZHEZJW-MR64-D3QM-Rv7V-Hxsa-zU24-wztY19" device = "/dev/sdb" # Hint only status = ["ALLOCATABLE"] dev_size = 35964301 # 17.1491 Gigabytes pe_start = 384 pe_count = 4390 # 17.1484 Gigabytes } pv2 { id = "wCoG4p-55Ui-9tbp-VTEA-jO6s-RAVx-UREW0G" device = "/dev/sdc" # Hint only status = ["ALLOCATABLE"] dev_size = 35964301 # 17.1491 Gigabytes pe_start = 384 pe_count = 4390 # 17.1484 Gigabytes } pv3 { id = "hGlUwi-zsBg-39FF-do88-pHxY-8XA2-9WKIiA" device = "/dev/sdd" # Hint only status = ["ALLOCATABLE"] dev_size = 35964301 # 17.1491 Gigabytes pe_start = 384 pe_count = 4390 # 17.1484 Gigabytes } } logical_volumes { mylv { id = "GhUYSF-qVM3-rzQo-a6D2-o0aV-LQet-Ur9OF9" status = ["READ", "WRITE", "VISIBLE"] segment_count = 2 segment1 { start_extent = 0 extent_count = 1280 # 5 Gigabytes type = "striped" stripe_count = 1 # linear stripes = [ "pv0", 0 ] } segment2 { start_extent = 1280 extent_count = 1280 # 5 Gigabytes type = "striped" stripe_count = 1 # linear stripes = [ "pv1", 0 ] } } }}

Revision History

Revision History
Revision 5.0-19Mon Feb 18 2013John Ha
rebuild for Author_Group.xml inclusion to build for GA
Revision 5.0-16Fri Feb 15 2013Steven Levine
Version for 6.4 GA release
Revision 5.0-12Mon Nov 27 2012Steven Levine
Version for 6.4 Beta release
Revision 5.0-10Wed Nov 21 2012Steven Levine
Clarifies description of thin snapshot volumes being used as origin volumes.
Revision 5.0-9Tue Nov 20 2012Steven Levine
Resolves: #810385
Clarifies the definition of a linear LVM logical volume.
Resolves: #833491
Documents the thin provisioning feature.
Resolves: #533057
Documents thin snapshot volumes.
Resolves: #872778
Corrects a small error in an lvchange example.
Resolves: #859561
Clarifies the description of the thin snapshot feature.
Resolves: #846413
Corrects a small error in a volume creation example.
Resolves: #796978
Documents LVM allocation policies.
Resolves: #853032
Clarifies support for snapshots of mirrored volumes.
Resolves: #857530
Documents support for raid10.
Resolves: #787018
Documents the lvmetad daemon.
Revision 5.0-7Fri Nov 16 2012Steven Levine
Updates and clarifies new chapters on thin provisioning.
Revision 5.0-2Tue Sep 25 2012Steven Levine
Adds new section on allocation policy
Revision 5.0-0Wed Sep 19 2012Steven Levine
First draft of thinly-provisioned volumes information
Revision 4.0-2Fri Jun 15 2012Steven Levine
Version for 6.3 GA release
Revision 4.0-1Fri Apr 13 2012Steven Levine
Resolves: #787018
Document snapshot autoextend feature.
Resolves: #749932
Document --nosync option of lvextend.
Resolves: #758695
Make prompts consistent in examples.
Resolves: #729715
Document LVM RAID support.
Revision 3.0-4Mon Nov 21 2011Steven Levine
Resolves: #755371, #755373, #755374
Documentation QE review
Revision 3.0-3Mon Nov 07 2011Steven Levine
Resolves: #749487
Clarifies pvcreate example for a whole disk.
Revision 3.0-2Wed Oct 12 2011Steven Levine
Resolves: #744999
Fixes small typographical errors.
Revision 3.0-1Mon Sep 19 2011Steven Levine
Initial revision for Red Hat Enterprise Linux 6.2 Beta release
Resolves: #730788
Documents support for issuing discards to a logical volume's underlying physical volume space when the physical volume space is no longer in use.
Resolves: #728361
Removes outdated reference to deprecated documentation.
Resolves: #714579
Fixes minor typographical errors.
Resolves: #664107
Corrects documented location of .cache file.
Revision 2.0-1Thu May 19 2011Steven Levine
Initial release for Red Hat Enterprise Linux 6.1
Resolves: #694619
Documents new cling allocation policy when extending a logical volume.
Resolves: #682649
Adds warning about running multiple mirror creation commands in succession on clustered volumes.
Resolves: #674100
Adds example of output for dmsetup ls --tree command.
Resolves: #694607
Documents support for including multiple --addtag and --deltag arguments on a single command line.
Resolves: #694604
Documents support for expanded character list in tags.
Resolves: #694611
Documents support for mirrored stripes.
Resolves: #694616
Documents support for snapshots of mirrored volumes.
Resolves: #694618
Documents support for snapshots of exclusively-activated cluster volumes.
Resolves: #682648
Documents that when a mirror leg is re-allocated the mirror log may be moved as well.
Resolves: #661530
Updates example cluster.conf to one that documents current features.
Resolves: #642400
Adds note about cluster log management being maintained by cluster node with lowest cluster ID.
Resolves: #663462
Removes outdated references to Xen virtual machine monitor.
Revision 1.0-1Wed Nov 10 2010Steven Levine
Initial release for Red Hat Enterprise Linux 6

Index

Symbols

/lib/udev/rules.d directory, udev Integration with the Device Mapper

D

data relocation, online, Online Data Relocation
deactivating volume groups, Activating and Deactivating Volume Groups
exclusive on one node, Activating and Deactivating Volume Groups
local node only, Activating and Deactivating Volume Groups
device numbers
major, Persistent Device Numbers
minor, Persistent Device Numbers
persistent, Persistent Device Numbers
device path names, Using CLI Commands
device scan filters, Controlling LVM Device Scans with Filters
device size, maximum, Creating Volume Groups
device special file directory, Creating Volume Groups
display
sorting output, Sorting LVM Reports
displaying
logical volumes, Displaying Logical Volumes, The lvs Command
physical volumes, Displaying Physical Volumes, The pvs Command
volume groups, Displaying Volume Groups, The vgs Command

F

failed devices
displaying, Displaying Information on Failed Devices
features, new and changed, New and Changed Features
feedback
contact information for this manual, We Need Feedback!
file system
growing on a logical volume, Growing a File System on a Logical Volume
filters, Controlling LVM Device Scans with Filters

G

growing file system
logical volume, Growing a File System on a Logical Volume

H

help display, Using CLI Commands

I

initializing
partitions, Initializing Physical Volumes
physical volumes, Initializing Physical Volumes
Insufficient Free Extents message, Insufficient Free Extents for a Logical Volume

L

linear logical volume
converting to mirrored, Changing Mirrored Volume Configuration
creation, Creating Linear Logical Volumes
definition, Linear Volumes
logging, Logging
logical volume
administration, general, Logical Volume Administration
changing parameters, Changing the Parameters of a Logical Volume Group
creation, Creating Linear Logical Volumes
creation example, Creating an LVM Logical Volume on Three Disks
definition, Logical Volumes, LVM Logical Volumes
displaying, Displaying Logical Volumes, Customized Reporting for LVM, The lvs Command
exclusive access, Activating Logical Volumes on Individual Nodes in a Cluster
extending, Growing Logical Volumes
growing, Growing Logical Volumes
linear, Creating Linear Logical Volumes
local access, Activating Logical Volumes on Individual Nodes in a Cluster
lvs display arguments, The lvs Command
mirrored, Creating Mirrored Volumes
reducing, Shrinking Logical Volumes
removing, Removing Logical Volumes
renaming, Renaming Logical Volumes
resizing, Resizing Logical Volumes
shrinking, Shrinking Logical Volumes
snapshot, Creating Snapshot Volumes
striped, Creating Striped Volumes
thinly-provisioned, Creating Thinly-Provisioned Logical Volumes
thinly-provisioned snapshot, Creating Thinly-Provisioned Snapshot Volumes
lvchange command, Changing the Parameters of a Logical Volume Group
lvconvert command, Changing Mirrored Volume Configuration
lvcreate command, Creating Linear Logical Volumes
lvdisplay command, Displaying Logical Volumes
lvextend command, Growing Logical Volumes
LVM
architecture overview, LVM Architecture Overview
clustered, The Clustered Logical Volume Manager (CLVM)
components, LVM Architecture Overview, LVM Components
custom report format, Customized Reporting for LVM
directory structure, Creating Volume Groups
help, Using CLI Commands
history, LVM Architecture Overview
label, Physical Volumes
logging, Logging
logical volume administration, Logical Volume Administration
physical volume administration, Physical Volume Administration
physical volume, definition, Physical Volumes
volume group, definition, Volume Groups
LVM1, LVM Architecture Overview
LVM2, LVM Architecture Overview
lvmdiskscan command, Scanning for Block Devices
lvmetad daemon, The Metadata Daemon (lvmetad)
lvreduce command, Resizing Logical Volumes, Shrinking Logical Volumes
lvremove command, Removing Logical Volumes
lvrename command, Renaming Logical Volumes
lvs command, Customized Reporting for LVM, The lvs Command
display arguments, The lvs Command
lvscan command, Displaying Logical Volumes

O

online data relocation, Online Data Relocation
overview
features, new and changed, New and Changed Features

R

removing
disk from a logical volume, Removing a Disk from a Logical Volume
logical volume, Removing Logical Volumes
physical volumes, Removing Physical Volumes
renaming
logical volume, Renaming Logical Volumes
volume group, Renaming a Volume Group
report format, LVM devices, Customized Reporting for LVM
resizing
logical volume, Resizing Logical Volumes
physical volume, Resizing a Physical Volume
rules.d directory, udev Integration with the Device Mapper

S

scanning
block devices, Scanning for Block Devices
scanning devices, filters, Controlling LVM Device Scans with Filters
snapshot logical volume
creation, Creating Snapshot Volumes
snapshot volume
definition, Snapshot Volumes
striped logical volume
creation, Creating Striped Volumes
creation example, Creating a Striped Logical Volume
definition, Striped Logical Volumes
extending, Extending a Striped Volume
growing, Extending a Striped Volume

T

thin snapshot volume, Thinly-Provisioned Snapshot Volumes
thin volume
creation, Creating Thinly-Provisioned Logical Volumes
thinly-provisioned logical volume, Thinly-Provisioned Logical Volumes (Thin Volumes)
creation, Creating Thinly-Provisioned Logical Volumes
thinly-provisioned snapshot logical volume
creation, Creating Thinly-Provisioned Snapshot Volumes
thinly-provisioned snapshot volume, Thinly-Provisioned Snapshot Volumes
troubleshooting, LVM Troubleshooting

V

verbose output, Using CLI Commands
vgcfbackup command, Backing Up Volume Group Metadata
vgcfrestore command, Backing Up Volume Group Metadata
vgchange command, Changing the Parameters of a Volume Group
vgcreate command, Creating Volume Groups, Creating Volume Groups in a Cluster
vgdisplay command, Displaying Volume Groups
vgexport command, Moving a Volume Group to Another System
vgextend command, Adding Physical Volumes to a Volume Group
vgimport command, Moving a Volume Group to Another System
vgmerge command, Combining Volume Groups
vgmknodes command, Recreating a Volume Group Directory
vgreduce command, Removing Physical Volumes from a Volume Group
vgrename command, Renaming a Volume Group
vgs command, Customized Reporting for LVM
display arguments, The vgs Command
vgscan command, Scanning Disks for Volume Groups to Build the Cache File
vgsplit command, Splitting a Volume Group
volume group
activating, Activating and Deactivating Volume Groups
administration, general, Volume Group Administration
changing parameters, Changing the Parameters of a Volume Group
combining, Combining Volume Groups
creating, Creating Volume Groups
creating in a cluster, Creating Volume Groups in a Cluster
deactivating, Activating and Deactivating Volume Groups
definition, Volume Groups
displaying, Displaying Volume Groups, Customized Reporting for LVM, The vgs Command
extending, Adding Physical Volumes to a Volume Group
growing, Adding Physical Volumes to a Volume Group
merging, Combining Volume Groups
moving between systems, Moving a Volume Group to Another System
reducing, Removing Physical Volumes from a Volume Group
removing, Removing Volume Groups
renaming, Renaming a Volume Group
shrinking, Removing Physical Volumes from a Volume Group
splitting, Splitting a Volume Group
example procedure, Splitting a Volume Group
vgs display arguments, The vgs Command
(Sebelumnya) 10 : Chapter 7. LVM Administra ...11 : Performance Tuning Guide (Berikutnya)