2002-01-07 14:12:11 +03:00
/*
2009-07-09 14:00:36 +04:00
* Copyright ( C ) 2001 - 2004 Sistina Software , Inc . All rights reserved .
2014-10-31 01:38:02 +03:00
* Copyright ( C ) 2004 - 2014 Red Hat , Inc . All rights reserved .
2002-01-07 14:12:11 +03:00
*
2004-03-30 23:35:44 +04:00
* This file is part of LVM2 .
*
* This copyrighted material is made available to anyone wishing to use ,
* modify , copy , or redistribute it subject to the terms and conditions
2007-08-21 00:55:30 +04:00
* of the GNU Lesser General Public License v .2 .1 .
2004-03-30 23:35:44 +04:00
*
2007-08-21 00:55:30 +04:00
* You should have received a copy of the GNU Lesser General Public License
2004-03-30 23:35:44 +04:00
* along with this program ; if not , write to the Free Software Foundation ,
2016-01-21 13:49:46 +03:00
* Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA
2002-01-07 14:12:11 +03:00
*/
# ifndef _LVM_DEFAULTS_H
# define _LVM_DEFAULTS_H
2018-06-29 12:09:03 +03:00
# include "device_mapper/vdo/vdo_limits.h"
Place the first PE at 1 MiB for all defaults
. When using default settings, this commit should change
nothing. The first PE continues to be placed at 1 MiB
resulting in a metadata area size of 1020 KiB (for
4K page sizes; slightly smaller for larger page sizes.)
. When default_data_alignment is disabled in lvm.conf,
align pe_start at 1 MiB, based on a default metadata area
size that adapts to the page size. Previously, disabling
this option would result in mda_size that was too small
for common use, and produced a 64 KiB aligned pe_start.
. Customized pe_start and mda_size values continue to be
set as before in lvm.conf and command line.
. Remove the configure option for setting default_data_alignment
at build time.
. Improve alignment related option descriptions.
. Add section about alignment to pvcreate man page.
Previously, DEFAULT_PVMETADATASIZE was 255 sectors.
However, the fact that the config setting named
"default_data_alignment" has a default value of 1 (MiB)
meant that DEFAULT_PVMETADATASIZE was having no effect.
The metadata area size is the space between the start of
the metadata area (page size offset from the start of the
device) and the first PE (1 MiB by default due to
default_data_alignment 1.) The result is a 1020 KiB metadata
area on machines with 4KiB page size (1024 KiB - 4 KiB),
and smaller on machines with larger page size.
If default_data_alignment was set to 0 (disabled), then
DEFAULT_PVMETADATASIZE 255 would take effect, and produce a
metadata area that was 188 KiB and pe_start of 192 KiB.
This was too small for common use.
This is fixed by making the default metadata area size a
computed value that matches the value produced by
default_data_alignment.
2018-11-14 00:00:11 +03:00
/*
* By default the first PE is placed at 1 MiB .
*
* If default_data_alignment is 2 , then the first PE
* is placed at 2 * 1 MiB .
*
* If default_data_alignment is 3 , then the first PE
* is placed at 3 * 1 MiB .
*/
# define FIRST_PE_AT_ONE_MB_IN_SECTORS 2048 /* 1 MiB in 512 byte sectors */
# define FIRST_PE_AT_ONE_MB_IN_MB 1
2010-08-12 08:11:48 +04:00
2002-01-08 22:17:08 +03:00
# define DEFAULT_ARCHIVE_ENABLED 1
# define DEFAULT_BACKUP_ENABLED 1
2002-01-07 14:12:11 +03:00
2007-02-28 21:27:13 +03:00
# define DEFAULT_CACHE_FILE_PREFIX ""
2002-01-07 14:12:11 +03:00
2002-01-08 22:17:08 +03:00
# define DEFAULT_ARCHIVE_DAYS 30
# define DEFAULT_ARCHIVE_NUMBER 10
2002-01-07 14:12:11 +03:00
# define DEFAULT_DEV_DIR " / dev"
2002-01-16 02:34:13 +03:00
# define DEFAULT_PROC_DIR " / proc"
2015-02-24 00:20:51 +03:00
# define DEFAULT_SYSTEM_ID_SOURCE "none"
devices: rework libudev usage
related to config settings:
obtain_device_info_from_udev (controls if lvm gets
a list of devices from readdir /dev or from libudev)
external_device_info_source (controls if lvm asks
libudev for device information)
. Make the obtain_device_list_from_udev setting
affect only the choice of readdir /dev vs libudev.
The setting no longer controls if udev is used for
device type checks.
. Change obtain_device_list_from_udev default to 0.
This helps avoid boot timeouts due to slow libudev
queries, avoids reported failures from
udev_enumerate_scan_devices, and avoids delays from
"device not initialized in udev database" errors.
Even without errors, for a system booting with 1024 PVs,
lvm2-pvscan times improve from about 100 sec to 15 sec,
and the pvscan command from about 64 sec to about 4 sec.
. For external_device_info_source="none", remove all
libudev device info queries, and use only lvm
native device info.
. For external_device_info_source="udev", first check
lvm native device info, then check libudev info.
. Remove sleep/retry loop when attempting libudev
queries for device info. udev info will simply
be skipped if it's not immediately available.
. Only set up a libdev connection if it will be used by
obtain_device_list_from_udev/external_device_info_source.
. For native multipath component detection, use
/etc/multipath/wwids. If a device has a wwid
matching an entry in the wwids file, then it's
considered a multipath component. This is
necessary to natively detect multipath
components when the mpath device is not set up.
2021-06-09 01:12:09 +03:00
# define DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV 0
2014-12-15 18:27:33 +03:00
# define DEFAULT_EXTERNAL_DEVICE_INFO_SOURCE "none"
2004-02-13 17:46:04 +03:00
# define DEFAULT_SYSFS_SCAN 1
2004-04-16 20:12:04 +04:00
# define DEFAULT_MD_COMPONENT_DETECTION 1
filters: add firmware RAID filter
Just like MD filtering that detects components of software RAID (md),
add detection for firmware RAID.
We're not adding any native code to detect this - there are lots of
firmware RAIDs out there which is just out of LVM scope. However,
with current changes with which we're able to get device info from
external sources (e.g. external_device_info_source="udev"), we can
do this easily if the external device status source has this kind
of information - which is the case of "udev" source where the results
of blkid scans are stored.
This detection should cover all firmware RAIDs that blkid can detect and
which are identified as:
ID_FS_TYPE = {adaptec,ddf,hpt45x,hpt37x,isw,jmicron,lsi_mega,nvidia,promise_fasttrack,silicon_medley,via}_raid_member
2014-09-09 17:05:57 +04:00
# define DEFAULT_FW_RAID_COMPONENT_DETECTION 0
2008-09-19 09:33:37 +04:00
# define DEFAULT_MD_CHUNK_ALIGNMENT 1
Mirror: Fix hangs and lock-ups caused by attempting label reads of mirrors
There is a problem with the way mirrors have been designed to handle
failures that is resulting in stuck LVM processes and hung I/O. When
mirrors encounter a write failure, they block I/O and notify userspace
to reconfigure the mirror to remove failed devices. This process is
open to a couple races:
1) Any LVM process other than the one that is meant to deal with the
mirror failure can attempt to read the mirror, fail, and block other
LVM commands (including the repair command) from proceeding due to
holding a lock on the volume group.
2) If there are multiple mirrors that suffer a failure in the same
volume group, a repair can block while attempting to read the LVM
label from one mirror while trying to repair the other.
Mitigation of these races has been attempted by disallowing label reading
of mirrors that are either suspended or are indicated as blocking by
the kernel. While this has closed the window of opportunity for hitting
the above problems considerably, it hasn't closed it completely. This is
because it is still possible to start an LVM command, read the status of
the mirror as healthy, and then perform the read for the label at the
moment after a the failure is discovered by the kernel.
I can see two solutions to this problem:
1) Allow users to configure whether mirrors can be candidates for LVM
labels (i.e. whether PVs can be created on mirror LVs). If the user
chooses to allow label scanning of mirror LVs, it will be at the expense
of a possible hang in I/O or LVM processes.
2) Instrument a way to allow asynchronous label reading - allowing
blocked label reads to be ignored while continuing to process the LVM
command. This would action would allow LVM commands to continue even
though they would have otherwise blocked trying to read a mirror. They
can then release their lock and allow a repair command to commence. In
the event of #2 above, the repair command already in progress can continue
and repair the failed mirror.
This patch brings solution #1. If solution #2 is developed later on, the
configuration option created in #1 can be negated - allowing mirrors to
be scanned for labels by default once again.
2013-10-23 04:14:33 +04:00
# define DEFAULT_IGNORE_LVM_MIRRORS 1
2011-11-11 19:11:08 +04:00
# define DEFAULT_MULTIPATH_COMPONENT_DETECTION 1
2014-04-24 14:12:28 +04:00
# define DEFAULT_IGNORE_SUSPENDED_DEVICES 0
2010-08-12 08:08:59 +04:00
# define DEFAULT_REQUIRE_RESTOREFILE_WITH_UUID 1
2009-08-01 21:07:36 +04:00
# define DEFAULT_DATA_ALIGNMENT_OFFSET_DETECTION 1
2009-08-01 21:08:43 +04:00
# define DEFAULT_DATA_ALIGNMENT_DETECTION 1
2011-04-13 01:59:01 +04:00
# define DEFAULT_ISSUE_DISCARDS 0
2011-04-28 21:33:34 +04:00
# define DEFAULT_PV_MIN_SIZE_KB 2048
lvmcache: improve duplicate PV handling
Wait to compare and choose alternate duplicate devices until
after all devices are scanned. During scanning, the first
duplicate dev is kept in lvmcache, and others are kept in a
new list (_found_duplicate_devs).
After all devices are scanned, compare all the duplicates
available for a given PVID and decide which is best.
If the dev used in lvmcache is changed, drop the old dev
from lvmcache entirely and rescan the replacement dev.
Previously the VG metadata from the old dev was kept in
lvmcache and only the dev was replaced.
A new config setting devices/allow_changes_with_duplicate_pvs
can be set to 0 which disallows modifying a VG or activating
LVs in it when the VG contains PVs with duplicate devices.
Set to 1 is the old behavior which allowed the VG to be
changed.
The logic for which of two devs is preferred has changed.
The primary goal is to choose a device that is currently
in use if the other isn't, e.g. by an active LV.
. prefer dev with fs mounted if the other doesn't, else
. prefer dev that is dm if the other isn't, else
. prefer dev in subsystem if the other isn't
If neither device is preferred by these rules, then don't
change devices in lvmcache, leaving the one that was found
first.
The previous logic for preferring a device was:
. prefer dev in subsystem if the other isn't, else
. prefer dev without holders if the other has holders, else
. prefer dev that is dm if the other isn't
2016-02-09 22:06:27 +03:00
# define DEFAULT_ALLOW_CHANGES_WITH_DUPLICATE_PVS 0
2002-01-07 14:12:11 +03:00
2006-09-01 00:56:33 +04:00
# define DEFAULT_LOCKING_LIB "liblvm2clusterlock.so"
2015-01-13 17:23:03 +03:00
# define DEFAULT_ERROR_WHEN_FULL 0
2006-09-02 05:18:17 +04:00
# define DEFAULT_FALLBACK_TO_LOCAL_LOCKING 1
# define DEFAULT_FALLBACK_TO_CLUSTERED_LOCKING 1
2009-07-25 03:28:55 +04:00
# define DEFAULT_WAIT_FOR_LOCKS 1
2015-07-06 19:19:17 +03:00
# define DEFAULT_LVMLOCKD_LOCK_RETRIES 3
2016-01-29 01:40:26 +03:00
# define DEFAULT_LVMETAD_UPDATE_WAIT_TIME 10
2009-09-02 18:47:39 +04:00
# define DEFAULT_PRIORITISE_WRITE_LOCKS 1
2010-03-05 17:48:33 +03:00
# define DEFAULT_USE_MLOCKALL 0
2010-10-25 15:20:54 +04:00
# define DEFAULT_METADATA_READ_ONLY 0
2012-01-26 18:02:42 +04:00
# define DEFAULT_LVDISPLAY_SHOWS_FULL_DEVICE_PATH 0
2016-02-29 22:38:31 +03:00
# define DEFAULT_UNKNOWN_DEVICE_NAME "[unknown]"
2018-11-16 21:21:20 +03:00
# define DEFAULT_USE_AIO 1
2002-02-08 17:28:52 +03:00
2015-03-05 23:00:44 +03:00
# define DEFAULT_SANLOCK_LV_EXTEND_MB 256
2014-10-22 23:02:29 +04:00
# define DEFAULT_MIRRORLOG MIRROR_LOG_DISK
2006-05-11 23:45:53 +04:00
# define DEFAULT_MIRROR_LOG_FAULT_POLICY "allocate"
2010-01-06 16:27:06 +03:00
# define DEFAULT_MIRROR_IMAGE_FAULT_POLICY "remove"
2009-11-27 17:35:38 +03:00
# define DEFAULT_MIRROR_MAX_IMAGES 8 /* limited by kernel DM_KCOPYD_MAX_REGIONS */
2016-08-12 20:14:28 +03:00
/* Limited by kernel failed devices bitfield in superblock (raid4/5/6 MD max 253) */
/*
* FIXME : Increase these to 64 and further to the MD maximum
* once the SubLVs split and name shift got enhanced
*/
2017-02-24 06:41:46 +03:00
# define DEFAULT_RAID1_MAX_IMAGES 64
# define DEFAULT_RAID_MAX_IMAGES 64
2016-07-20 18:20:15 +03:00
# define DEFAULT_ALLOCATION_STRIPE_ALL_DEVICES 0 /* Don't stripe across all devices if not -i/--stripes given */
2015-09-28 23:38:40 +03:00
2011-12-06 23:30:15 +04:00
# define DEFAULT_RAID_FAULT_POLICY "warn"
2014-10-31 01:38:02 +03:00
2011-08-11 09:00:20 +04:00
# define DEFAULT_DMEVENTD_RAID_LIB "libdevmapper-event-lvm2raid.so"
2006-01-27 22:05:05 +03:00
# define DEFAULT_DMEVENTD_MIRROR_LIB "libdevmapper-event-lvm2mirror.so"
2010-08-17 02:54:35 +04:00
# define DEFAULT_DMEVENTD_SNAPSHOT_LIB "libdevmapper-event-lvm2snapshot.so"
2011-12-21 17:08:11 +04:00
# define DEFAULT_DMEVENTD_THIN_LIB "libdevmapper-event-lvm2thin.so"
2017-01-18 11:54:32 +03:00
# define DEFAULT_DMEVENTD_THIN_COMMAND "lvm lvextend --use-policies"
2018-07-09 12:43:12 +03:00
# define DEFAULT_DMEVENTD_VDO_LIB "libdevmapper-event-lvm2vdo.so"
# define DEFAULT_DMEVENTD_VDO_COMMAND "lvm lvextend --use-policies"
2006-05-12 23:16:48 +04:00
# define DEFAULT_DMEVENTD_MONITOR 1
2010-01-05 23:56:51 +03:00
# define DEFAULT_BACKGROUND_POLLING 1
2006-01-27 22:05:05 +03:00
2014-03-31 17:57:30 +04:00
# ifndef DMEVENTD_PATH
2014-04-04 05:22:40 +04:00
# define DEFAULT_DMEVENTD_PATH ""
2014-03-31 17:57:30 +04:00
# else
2014-04-04 05:22:40 +04:00
# define DEFAULT_DMEVENTD_PATH DMEVENTD_PATH
# endif
2023-07-16 18:35:20 +03:00
# define DEFAULT_MAX_EXEC_ARGS 15 /* Max number of accepted options args */
2014-04-04 05:22:40 +04:00
# ifdef THIN_CHECK_NEEDS_CHECK
2015-04-23 18:35:34 +03:00
# define DEFAULT_THIN_CHECK_OPTION1 "-q"
# define DEFAULT_THIN_CHECK_OPTION2 "--clear-needs-check-flag"
2015-06-23 14:18:53 +03:00
# define DEFAULT_THIN_CHECK_OPTIONS_CONFIG "#S" DEFAULT_THIN_CHECK_OPTION1 "#S" DEFAULT_THIN_CHECK_OPTION2
2014-04-04 05:22:40 +04:00
# else
2015-04-23 18:35:34 +03:00
# define DEFAULT_THIN_CHECK_OPTION1 "-q"
# define DEFAULT_THIN_CHECK_OPTION2 ""
2015-06-23 14:18:53 +03:00
# define DEFAULT_THIN_CHECK_OPTIONS_CONFIG "#S" DEFAULT_THIN_CHECK_OPTION1
2014-03-31 17:57:30 +04:00
# endif
config: {thin,cache}_{check,repair}_options are never undefined
Require global/{thin,cache}_{check,repair}_options to be always defined.
If not defined directly by user in the configuration and if there's no
concrete default option to use, make "" (empty string) the default one -
it's then clearly visible in the "lvmconfig --type default" (and
generated lvm.conf) and also it makes its handling in the code more
straightforward so we don't need to handle undefined values.
This means, if there are no default values for these settings defined,
we end up with this generated now:
{thin,cache}_{check,repair}_options = [ "" ]
So the value is never undefined and if it is, it's an error.
(The cache_repair_options is actually not used in the code at the moment,
but once the code using this setting is in, it will follow the same logic
as used for thin_repair_options.)
2015-07-14 11:03:19 +03:00
# define DEFAULT_THIN_REPAIR_OPTION1 ""
# define DEFAULT_THIN_REPAIR_OPTIONS_CONFIG "#S" DEFAULT_THIN_REPAIR_OPTION1
2023-06-23 15:39:44 +03:00
# define DEFAULT_THIN_RESTORE_OPTION1 ""
# define DEFAULT_THIN_RESTORE_OPTIONS_CONFIG "#S" DEFAULT_THIN_RESTORE_OPTION1
2011-11-05 02:44:21 +04:00
# define DEFAULT_THIN_POOL_METADATA_REQUIRE_SEPARATE_PVS 0
2021-01-12 19:59:29 +03:00
# define DEFAULT_THIN_POOL_CROP_METADATA 0
# define DEFAULT_THIN_POOL_MAX_METADATA_SIZE_V1_KB (UINT64_C(255) * ((1 << 14) - 64) * 4) /* KB */ /* 0x3f8040 blocks */
2017-06-05 12:26:01 +03:00
# define DEFAULT_THIN_POOL_MAX_METADATA_SIZE (DM_THIN_MAX_METADATA_SIZE / 2) /* KB */
2011-11-05 02:43:10 +04:00
# define DEFAULT_THIN_POOL_MIN_METADATA_SIZE 2048 /* KB */
2017-06-09 22:29:34 +03:00
# define DEFAULT_THIN_POOL_OPTIMAL_METADATA_SIZE (128 * 1024) /* KB */
2013-10-04 14:30:33 +04:00
# define DEFAULT_THIN_POOL_CHUNK_SIZE_POLICY "generic"
2012-11-26 14:20:13 +04:00
# define DEFAULT_THIN_POOL_CHUNK_SIZE 64 /* KB */
2013-09-25 18:00:52 +04:00
# define DEFAULT_THIN_POOL_CHUNK_SIZE_PERFORMANCE 512 /* KB */
2019-01-29 20:45:52 +03:00
/* Chunk size big enough it no longer needs jump by power-of-2 */
# define DEFAULT_THIN_POOL_CHUNK_SIZE_ALIGNED 1024 /* KB */
2012-11-26 14:20:13 +04:00
# define DEFAULT_THIN_POOL_DISCARDS "passdown"
# define DEFAULT_THIN_POOL_ZERO 1
2014-02-04 21:57:08 +04:00
# define DEFAULT_POOL_METADATA_SPARE 1 /* thin + cache */
2020-06-24 13:11:21 +03:00
# define DEFAULT_ZERO_METADATA 1 /* thin + cache */
2011-11-05 02:43:10 +04:00
2015-07-07 10:51:40 +03:00
# ifdef CACHE_CHECK_NEEDS_CHECK
# define DEFAULT_CACHE_CHECK_OPTION1 "-q"
# define DEFAULT_CACHE_CHECK_OPTION2 "--clear-needs-check-flag"
# define DEFAULT_CACHE_CHECK_OPTIONS_CONFIG "#S" DEFAULT_CACHE_CHECK_OPTION1 "#S" DEFAULT_CACHE_CHECK_OPTION2
# else
# define DEFAULT_CACHE_CHECK_OPTION1 "-q"
# define DEFAULT_CACHE_CHECK_OPTION2 ""
# define DEFAULT_CACHE_CHECK_OPTIONS_CONFIG "#S" DEFAULT_CACHE_CHECK_OPTION1
# endif
config: {thin,cache}_{check,repair}_options are never undefined
Require global/{thin,cache}_{check,repair}_options to be always defined.
If not defined directly by user in the configuration and if there's no
concrete default option to use, make "" (empty string) the default one -
it's then clearly visible in the "lvmconfig --type default" (and
generated lvm.conf) and also it makes its handling in the code more
straightforward so we don't need to handle undefined values.
This means, if there are no default values for these settings defined,
we end up with this generated now:
{thin,cache}_{check,repair}_options = [ "" ]
So the value is never undefined and if it is, it's an error.
(The cache_repair_options is actually not used in the code at the moment,
but once the code using this setting is in, it will follow the same logic
as used for thin_repair_options.)
2015-07-14 11:03:19 +03:00
# define DEFAULT_CACHE_REPAIR_OPTION1 ""
# define DEFAULT_CACHE_REPAIR_OPTIONS_CONFIG "#S" DEFAULT_CACHE_REPAIR_OPTION1
2023-06-23 15:39:44 +03:00
# define DEFAULT_CACHE_RESTORE_OPTION1 ""
# define DEFAULT_CACHE_RESTORE_OPTIONS_CONFIG "#S" DEFAULT_CACHE_RESTORE_OPTION1
2014-01-28 22:25:02 +04:00
# define DEFAULT_CACHE_POOL_METADATA_REQUIRE_SEPARATE_PVS 0
2014-02-04 17:03:52 +04:00
# define DEFAULT_CACHE_POOL_CHUNK_SIZE 64 /* KB */
2016-08-24 11:16:01 +03:00
# define DEFAULT_CACHE_POOL_MAX_CHUNKS 1000000
2014-02-04 21:50:27 +04:00
# define DEFAULT_CACHE_POOL_MIN_METADATA_SIZE 2048 /* KB */
# define DEFAULT_CACHE_POOL_MAX_METADATA_SIZE (16 * 1024 * 1024) /* KB */
2015-07-20 12:44:15 +03:00
# define DEFAULT_CACHE_POLICY "mq"
2017-02-26 22:19:07 +03:00
# define DEFAULT_CACHE_METADATA_FORMAT CACHE_METADATA_FORMAT_UNSELECTED /* Autodetect */
2015-07-20 12:44:15 +03:00
# define DEFAULT_CACHE_MODE "writethrough"
2014-01-28 22:25:02 +04:00
2018-06-29 12:09:03 +03:00
/* VDO defaults */
# define DEFAULT_VDO_USE_COMPRESSION (true)
# define DEFAULT_VDO_USE_DEDUPLICATION (true)
2018-12-20 15:17:30 +03:00
# define DEFAULT_VDO_USE_METADATA_HINTS (true)
# define DEFAULT_VDO_MINIMUM_IO_SIZE (4096)
2018-06-29 12:09:03 +03:00
# define DEFAULT_VDO_BLOCK_MAP_CACHE_SIZE_MB (DM_VDO_BLOCK_MAP_CACHE_SIZE_MINIMUM_MB)
2018-12-20 15:17:30 +03:00
# define DEFAULT_VDO_BLOCK_MAP_ERA_LENGTH (DM_VDO_BLOCK_MAP_ERA_LENGTH_MAXIMUM)
2018-06-29 12:09:03 +03:00
# define DEFAULT_VDO_USE_SPARSE_INDEX (false)
# define DEFAULT_VDO_CHECK_POINT_FREQUENCY (0)
# define DEFAULT_VDO_INDEX_MEMORY_SIZE_MB (DM_VDO_INDEX_MEMORY_SIZE_MINIMUM_MB)
# define DEFAULT_VDO_SLAB_SIZE_MB (2 * 1024) // 2GiB ... 19 slabbits
# define DEFAULT_VDO_ACK_THREADS (1)
2019-10-04 15:52:40 +03:00
# define DEFAULT_VDO_BIO_THREADS (4)
2018-06-29 12:09:03 +03:00
# define DEFAULT_VDO_BIO_ROTATION (64)
# define DEFAULT_VDO_CPU_THREADS (2)
# define DEFAULT_VDO_HASH_ZONE_THREADS (1)
# define DEFAULT_VDO_LOGICAL_THREADS (1)
# define DEFAULT_VDO_PHYSICAL_THREADS (1)
# define DEFAULT_VDO_WRITE_POLICY "auto"
2018-12-20 15:17:30 +03:00
# define DEFAULT_VDO_MAX_DISCARD (DM_VDO_MAX_DISCARD_MINIMUM)
2018-06-29 12:09:03 +03:00
# define DEFAULT_VDO_FORMAT_OPTIONS_CONFIG "#S" ""
/*
* VDO pool will reverve some sectors in the front and the back of pool device to avoid
* seeing same device twice in the system .
*/
2021-06-28 18:53:08 +03:00
# define DEFAULT_VDO_POOL_HEADER_SIZE_KB (512)
2018-06-29 12:09:03 +03:00
2017-04-08 20:43:20 +03:00
# define DEFAULT_FSADM_PATH FSADM_PATH
2002-01-09 22:16:48 +03:00
# define DEFAULT_UMASK 0077
2009-10-05 16:44:20 +04:00
# define DEFAULT_FORMAT "lvm2"
2002-04-24 22:20:51 +04:00
2002-12-20 02:25:55 +03:00
# define DEFAULT_STRIPESIZE 64 /* KB */
2016-03-01 17:25:49 +03:00
# define DEFAULT_RECORD_LVS_HISTORY 0
2016-03-01 17:29:27 +03:00
# define DEFAULT_LVS_HISTORY_RETENTION_TIME 0
2010-06-30 16:17:24 +04:00
# define DEFAULT_PVMETADATAIGNORE 0
2002-11-18 17:01:16 +03:00
# define DEFAULT_PVMETADATACOPIES 1
2010-06-29 00:36:37 +04:00
# define DEFAULT_VGMETADATACOPIES 0
2003-03-24 21:08:53 +03:00
# define DEFAULT_LABELSECTOR UINT64_C(1)
2007-11-09 19:51:54 +03:00
# define DEFAULT_READ_AHEAD "auto"
2010-01-07 22:54:21 +03:00
# define DEFAULT_UDEV_RULES 1
2011-08-02 14:49:57 +04:00
# define DEFAULT_UDEV_SYNC 1
2016-02-22 18:42:03 +03:00
# define DEFAULT_NOTIFY_DBUS 1
2011-06-28 01:43:58 +04:00
# define DEFAULT_VERIFY_UDEV_OPERATIONS 0
2011-09-22 21:39:56 +04:00
# define DEFAULT_RETRY_DEACTIVATION 1
2011-07-01 18:09:19 +04:00
# define DEFAULT_ACTIVATION_CHECKS 0
2008-01-17 18:31:18 +03:00
# define DEFAULT_EXTENT_SIZE 4096 /* In KB */
2009-07-09 14:00:36 +04:00
# define DEFAULT_MAX_PV 0
# define DEFAULT_MAX_LV 0
# define DEFAULT_ALLOC_POLICY ALLOC_NORMAL
2011-02-27 03:38:31 +03:00
# define DEFAULT_MIRROR_LOGS_REQUIRE_SEPARATE_PVS 0
# define DEFAULT_MAXIMISE_CLING 1
2009-07-09 14:00:36 +04:00
# define DEFAULT_CLUSTERED 0
2002-05-07 16:50:01 +04:00
2002-11-18 17:01:16 +03:00
# define DEFAULT_MSG_PREFIX " "
2002-05-07 16:50:01 +04:00
# define DEFAULT_CMD_NAME 0
2002-11-18 17:01:16 +03:00
# define DEFAULT_OVERWRITE 0
# ifndef DEFAULT_LOG_FACILITY
2003-04-15 17:24:42 +04:00
# define DEFAULT_LOG_FACILITY LOG_USER
2002-11-18 17:01:16 +03:00
# endif
2016-06-14 12:58:01 +03:00
# define DEFAULT_COMMAND_LOG_REPORT 0
2021-10-12 01:08:05 +03:00
# define DEFAULT_SYSLOG 0
2002-11-18 17:01:16 +03:00
# define DEFAULT_VERBOSE 0
config: add silent mode
Accept -q as the short form of --quiet.
Suppress non-essential standard output if -q is given twice.
Treat log/silent in lvm.conf as equivalent to -qq.
Review all log_print messages and change some to
log_print_unless_silent.
When silent, the following commands still produce output:
dumpconfig, lvdisplay, lvmdiskscan, lvs, pvck, pvdisplay,
pvs, version, vgcfgrestore -l, vgdisplay, vgs.
[Needs checking.]
Non-essential messages are shifted from log level 4 to log level 5
for syslog and lvm2_log_fn purposes.
2012-08-25 23:35:48 +04:00
# define DEFAULT_SILENT 0
2002-11-18 17:01:16 +03:00
# define DEFAULT_LOGLEVEL 0
2019-02-22 21:01:20 +03:00
# define DEFAULT_INDENT 0
2009-11-30 20:17:11 +03:00
# define DEFAULT_ABORT_ON_INTERNAL_ERRORS 0
2017-01-09 18:30:49 +03:00
# define DEFAULT_UNITS "r"
2002-12-12 23:55:49 +03:00
# define DEFAULT_SUFFIX 1
2004-03-08 21:13:22 +03:00
# define DEFAULT_HOSTTAGS 0
2002-11-18 17:01:16 +03:00
2009-09-28 20:23:44 +04:00
# ifndef DEFAULT_SI_UNIT_CONSISTENCY
# define DEFAULT_SI_UNIT_CONSISTENCY 1
# endif
2003-01-09 01:44:07 +03:00
# ifdef DEVMAPPER_SUPPORT
2003-04-15 17:24:42 +04:00
# define DEFAULT_ACTIVATION 1
2003-01-09 01:44:07 +03:00
# else
2003-04-15 17:24:42 +04:00
# define DEFAULT_ACTIVATION 0
2003-01-09 01:44:07 +03:00
# endif
2002-05-07 16:50:01 +04:00
2013-10-04 17:32:23 +04:00
# define DEFAULT_RESERVED_MEMORY 8192
# define DEFAULT_RESERVED_STACK 64 /* KB */
# define DEFAULT_PROCESS_PRIORITY -18
2013-09-27 15:58:55 +04:00
2013-07-12 11:27:17 +04:00
# define DEFAULT_AUTO_SET_ACTIVATION_SKIP 1
activation: Add "degraded" activation mode
Currently, we have two modes of activation, an unnamed nominal mode
(which I will refer to as "complete") and "partial" mode. The
"complete" mode requires that a volume group be 'complete' - that
is, no missing PVs. If there are any missing PVs, no affected LVs
are allowed to activate - even RAID LVs which might be able to
tolerate a failure. The "partial" mode allows anything to be
activated (or at least attempted). If a non-redundant LV is
missing a portion of its addressable space due to a device failure,
it will be replaced with an error target. RAID LVs will either
activate or fail to activate depending on how badly their
redundancy is compromised.
This patch adds a third option, "degraded" mode. This mode can
be selected via the '--activationmode {complete|degraded|partial}'
option to lvchange/vgchange. It can also be set in lvm.conf.
The "degraded" activation mode allows RAID LVs with a sufficient
level of redundancy to activate (e.g. a RAID5 LV with one device
failure, a RAID6 with two device failures, or RAID1 with n-1
failures). RAID LVs with too many device failures are not allowed
to activate - nor are any non-redundant LVs that may have been
affected. This patch also makes the "degraded" mode the default
activation mode.
The degraded activation mode does not yet work in a cluster. A
new cluster lock flag (LCK_DEGRADED_MODE) will need to be created
to make that work. Currently, there is limited space for this
extra flag and I am looking for possible solutions. One possible
solution is to usurp LCK_CONVERT, as it is not used. When the
locking_type is 3, the degraded mode flag simply gets dropped and
the old ("complete") behavior is exhibited.
2014-07-10 07:56:11 +04:00
# define DEFAULT_ACTIVATION_MODE "degraded"
2011-11-29 00:37:51 +04:00
# define DEFAULT_USE_LINEAR_TARGET 1
2008-09-19 10:42:00 +04:00
# define DEFAULT_STRIPE_FILLER "error"
2017-04-13 17:10:49 +03:00
# define DEFAULT_RAID_REGION_SIZE 2048 /* KB */
2003-04-30 19:27:48 +04:00
# define DEFAULT_INTERVAL 15
2003-04-25 02:10:56 +04:00
2013-03-06 15:47:23 +04:00
# define DEFAULT_MAX_HISTORY 100
2002-01-08 22:17:08 +03:00
2014-12-05 13:46:26 +03:00
# define DEFAULT_REP_COMPACT_OUTPUT 0
2002-12-12 23:55:49 +03:00
# define DEFAULT_REP_ALIGNED 1
# define DEFAULT_REP_BUFFERED 1
2008-06-25 02:48:53 +04:00
# define DEFAULT_REP_COLUMNS_AS_ROWS 0
2002-12-12 23:55:49 +03:00
# define DEFAULT_REP_HEADINGS 1
2008-04-20 04:15:08 +04:00
# define DEFAULT_REP_PREFIXES 0
2008-06-25 01:21:04 +04:00
# define DEFAULT_REP_QUOTED 1
2002-12-12 23:55:49 +03:00
# define DEFAULT_REP_SEPARATOR " "
2014-07-10 18:18:45 +04:00
# define DEFAULT_REP_LIST_ITEM_SEPARATOR ","
2015-05-25 17:13:07 +03:00
# define DEFAULT_TIME_FORMAT "%Y-%m-%d %T %z"
2002-12-12 23:55:49 +03:00
2016-05-24 13:05:42 +03:00
# define DEFAULT_REP_OUTPUT_FORMAT "basic"
2015-10-16 17:25:51 +03:00
# define DEFAULT_COMPACT_OUTPUT_COLS ""
2016-06-14 14:25:03 +03:00
# define DEFAULT_COMMAND_LOG_SELECTION "!(log_type=status && message=success)"
2014-05-15 11:32:27 +04:00
# define DEFAULT_LVS_COLS "lv_name,vg_name,lv_attr,lv_size,pool_lv,origin,data_percent,metadata_percent,move_pv,mirror_log,copy_percent,convert_lv"
2002-12-12 23:55:49 +03:00
# define DEFAULT_VGS_COLS "vg_name,pv_count,lv_count,snap_count,vg_attr,vg_size,vg_free"
# define DEFAULT_PVS_COLS "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free"
# define DEFAULT_SEGS_COLS "lv_name,vg_name,lv_attr,stripes,segtype,seg_size"
2005-04-20 00:58:25 +04:00
# define DEFAULT_PVSEGS_COLS "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pvseg_start,pvseg_size"
2013-09-18 04:09:15 +04:00
# define DEFAULT_DEVTYPES_COLS "devtype_name,devtype_max_partitions,devtype_description"
2016-05-10 16:15:48 +03:00
# define DEFAULT_COMMAND_LOG_COLS "log_seq_num,log_type,log_context,log_object_type,log_object_name,log_object_id,log_object_group,log_object_group_id,log_message,log_errno,log_ret_code"
2002-12-12 23:55:49 +03:00
2013-07-02 16:34:52 +04:00
# define DEFAULT_LVS_COLS_VERB "lv_name,vg_name,seg_count,lv_attr,lv_size,lv_major,lv_minor,lv_kernel_major,lv_kernel_minor,pool_lv,origin,data_percent,metadata_percent,move_pv,copy_percent,mirror_log,convert_lv,lv_uuid,lv_profile"
# define DEFAULT_VGS_COLS_VERB "vg_name,vg_attr,vg_extent_size,pv_count,lv_count,snap_count,vg_size,vg_free,vg_uuid,vg_profile"
2004-08-11 17:15:05 +04:00
# define DEFAULT_PVS_COLS_VERB "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,dev_size,pv_uuid"
2002-12-12 23:55:49 +03:00
# define DEFAULT_SEGS_COLS_VERB "lv_name,vg_name,lv_attr,seg_start,seg_size,stripes,segtype,stripesize,chunksize"
2007-12-15 00:53:02 +03:00
# define DEFAULT_PVSEGS_COLS_VERB "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pvseg_start,pvseg_size,lv_name,seg_start_pe,segtype,seg_pe_ranges"
2013-09-18 04:09:15 +04:00
# define DEFAULT_DEVTYPES_COLS_VERB "devtype_name,devtype_max_partitions,devtype_description"
2002-12-12 23:55:49 +03:00
2016-05-03 12:18:16 +03:00
# define DEFAULT_VGS_COLS_FULL "vg_all"
# define DEFAULT_PVS_COLS_FULL "pv_all"
# define DEFAULT_LVS_COLS_FULL "lv_all"
# define DEFAULT_PVSEGS_COLS_FULL "pvseg_all,pv_uuid,lv_uuid"
# define DEFAULT_SEGS_COLS_FULL "seg_all,lv_uuid"
2002-12-12 23:55:49 +03:00
# define DEFAULT_LVS_SORT "vg_name,lv_name"
# define DEFAULT_VGS_SORT "vg_name"
# define DEFAULT_PVS_SORT "pv_name"
# define DEFAULT_SEGS_SORT "vg_name,lv_name,seg_start"
2005-04-20 00:58:25 +04:00
# define DEFAULT_PVSEGS_SORT "pv_name,pvseg_start"
2013-09-18 04:09:15 +04:00
# define DEFAULT_DEVTYPES_SORT "devtype_name"
2016-05-10 16:15:48 +03:00
# define DEFAULT_COMMAND_LOG_SORT "log_seq_num"
2002-12-12 23:55:49 +03:00
2016-05-03 12:18:16 +03:00
# define DEFAULT_VGS_SORT_FULL "vg_name"
# define DEFAULT_PVS_SORT_FULL "pv_name"
# define DEFAULT_LVS_SORT_FULL "vg_name,lv_name"
# define DEFAULT_PVSEGS_SORT_FULL "pv_uuid,pvseg_start"
# define DEFAULT_SEGS_SORT_FULL "lv_uuid,seg_start"
2009-06-04 16:01:15 +04:00
# define DEFAULT_MIRROR_DEVICE_FAULT_POLICY "remove"
# define DEFAULT_MIRROR_LOG_FAULT_POLICY "allocate"
2010-10-15 20:28:14 +04:00
# define DEFAULT_SNAPSHOT_AUTOEXTEND_THRESHOLD 100
# define DEFAULT_SNAPSHOT_AUTOEXTEND_PERCENT 20
2011-12-21 17:10:52 +04:00
# define DEFAULT_THIN_POOL_AUTOEXTEND_THRESHOLD 100
# define DEFAULT_THIN_POOL_AUTOEXTEND_PERCENT 20
2018-07-09 12:43:12 +03:00
# define DEFAULT_VDO_POOL_AUTOEXTEND_THRESHOLD 100
# define DEFAULT_VDO_POOL_AUTOEXTEND_PERCENT 20
2009-06-04 16:01:15 +04:00
2019-02-20 22:30:46 +03:00
# define DEFAULT_SCAN_LVS 0
2018-08-29 21:14:18 +03:00
2018-12-07 23:35:22 +03:00
# define DEFAULT_HINTS "all"
2019-03-04 20:18:34 +03:00
# define DEFAULT_IO_MEMORY_SIZE_KB 8192
2019-03-01 22:55:59 +03:00
2019-05-21 20:06:34 +03:00
# define DEFAULT_MD_COMPONENT_CHECKS "auto"
device usage based on devices file
The LVM devices file lists devices that lvm can use. The default
file is /etc/lvm/devices/system.devices, and the lvmdevices(8)
command is used to add or remove device entries. If the file
does not exist, or if lvm.conf includes use_devicesfile=0, then
lvm will not use a devices file. When the devices file is in use,
the regex filter is not used, and the filter settings in lvm.conf
or on the command line are ignored.
LVM records devices in the devices file using hardware-specific
IDs, such as the WWID, and attempts to use subsystem-specific
IDs for virtual device types. These device IDs are also written
in the VG metadata. When no hardware or virtual ID is available,
lvm falls back using the unstable device name as the device ID.
When devnames are used, lvm performs extra scanning to find
devices if their devname changes, e.g. after reboot.
When proper device IDs are used, an lvm command will not look
at devices outside the devices file, but when devnames are used
as a fallback, lvm will scan devices outside the devices file
to locate PVs on renamed devices. A config setting
search_for_devnames can be used to control the scanning for
renamed devname entries.
Related to the devices file, the new command option
--devices <devnames> allows a list of devices to be specified for
the command to use, overriding the devices file. The listed
devices act as a sort of devices file in terms of limiting which
devices lvm will see and use. Devices that are not listed will
appear to be missing to the lvm command.
Multiple devices files can be kept in /etc/lvm/devices, which
allows lvm to be used with different sets of devices, e.g.
system devices do not need to be exposed to a specific application,
and the application can use lvm on its own set of devices that are
not exposed to the system. The option --devicesfile <filename> is
used to select the devices file to use with the command. Without
the option set, the default system devices file is used.
Setting --devicesfile "" causes lvm to not use a devices file.
An existing, empty devices file means lvm will see no devices.
The new command vgimportdevices adds PVs from a VG to the devices
file and updates the VG metadata to include the device IDs.
vgimportdevices -a will import all VGs into the system devices file.
LVM commands run by dmeventd not use a devices file by default,
and will look at all devices on the system. A devices file can
be created for dmeventd (/etc/lvm/devices/dmeventd.devices) If
this file exists, lvm commands run by dmeventd will use it.
Internal implementaion:
- device_ids_read - read the devices file
. add struct dev_use (du) to cmd->use_devices for each devices file entry
- dev_cache_scan - get /dev entries
. add struct device (dev) to dev_cache for each device on the system
- device_ids_match - match devices file entries to /dev entries
. match each du on cmd->use_devices to a dev in dev_cache, using device ID
. on match, set du->dev, dev->id, dev->flags MATCHED_USE_ID
- label_scan - read lvm headers and metadata from devices
. filters are applied, those that do not need data from the device
. filter-deviceid skips devs without MATCHED_USE_ID, i.e.
skips /dev entries that are not listed in the devices file
. read lvm label from dev
. filters are applied, those that use data from the device
. read lvm metadata from dev
. add info/vginfo structs for PVs/VGs (info is "lvmcache")
- device_ids_find_renamed_devs - handle devices with unstable devname ID
where devname changed
. this step only needed when devs do not have proper device IDs,
and their dev names change, e.g. after reboot sdb becomes sdc.
. detect incorrect match because PVID in the devices file entry
does not match the PVID found when the device was read above
. undo incorrect match between du and dev above
. search system devices for new location of PVID
. update devices file with new devnames for PVIDs on renamed devices
. label_scan the renamed devs
- continue with command processing
2020-06-23 21:25:41 +03:00
# define DEFAULT_DEVICES_FILE "system.devices"
# define DEFAULT_SEARCH_FOR_DEVNAMES "auto"
devices: rework libudev usage
related to config settings:
obtain_device_info_from_udev (controls if lvm gets
a list of devices from readdir /dev or from libudev)
external_device_info_source (controls if lvm asks
libudev for device information)
. Make the obtain_device_list_from_udev setting
affect only the choice of readdir /dev vs libudev.
The setting no longer controls if udev is used for
device type checks.
. Change obtain_device_list_from_udev default to 0.
This helps avoid boot timeouts due to slow libudev
queries, avoids reported failures from
udev_enumerate_scan_devices, and avoids delays from
"device not initialized in udev database" errors.
Even without errors, for a system booting with 1024 PVs,
lvm2-pvscan times improve from about 100 sec to 15 sec,
and the pvscan command from about 64 sec to about 4 sec.
. For external_device_info_source="none", remove all
libudev device info queries, and use only lvm
native device info.
. For external_device_info_source="udev", first check
lvm native device info, then check libudev info.
. Remove sleep/retry loop when attempting libudev
queries for device info. udev info will simply
be skipped if it's not immediately available.
. Only set up a libdev connection if it will be used by
obtain_device_list_from_udev/external_device_info_source.
. For native multipath component detection, use
/etc/multipath/wwids. If a device has a wwid
matching an entry in the wwids file, then it's
considered a multipath component. This is
necessary to natively detect multipath
components when the mpath device is not set up.
2021-06-09 01:12:09 +03:00
# define DEFAULT_WWIDS_FILE " / etc / multipath / wwids"
2021-07-16 00:33:50 +03:00
# define PVS_ONLINE_DIR DEFAULT_RUN_DIR " / pvs_online"
# define VGS_ONLINE_DIR DEFAULT_RUN_DIR " / vgs_online"
# define PVS_LOOKUP_DIR DEFAULT_RUN_DIR " / pvs_lookup"
2022-09-01 00:05:07 +03:00
# define DEFAULT_DEVICE_ID_SYSFS_DIR " / sys / " /* trailing / to match dm_sysfs_dir() */
2002-11-18 17:01:16 +03:00
# endif /* _LVM_DEFAULTS_H */