Linux "lvconvert" Command Line Options and Examples
Change logical volume layout

lvconvert changes the LV type and includes utilities for LV data maintenance. The LV type controls data layout and redundancy. The LV type is also called the segment type or segtype.


Usage:

lvconvert option_args position_args
[ option_args ]
[ position_args ]






Command Line Options:

--alloc
Determines the allocation policy when a command needs to allocate Physical Extents (PEs) from the VG. Each VG and LV has anallocation policy which can be changed with vgchange/lvchange, or overriden on the command line. normal applies common senserules such as not placing parallel stripes on the same PV. inherit applies the VG policy to an LV. contiguous requires newPEs be placed adjacent to existing PEs. cling places new PEs on the same PV as existing PEs in the same stripe of the LV. Ifthere are sufficient PEs for an allocation, but normal does not use them, anywhere will use them even if it reduces perfor‐mance, e.g. by placing two stripes on the same PV. Optional positional PV args on the command line can also be used to limitwhich PVs the command will use for allocation. See lvm(8) for more information about allocation.
lvconvert --alloc ...
-b|--background
If the operation requires polling, this option causes the command to return before the operation is complete, and polling isdone in the background.
lvconvert -b|--background ...
-H|--cache
Specifies the command is handling a cache LV or cache pool. See --type cache and --type cache-pool. See lvmcache(7) for moreinformation about LVM caching.
lvconvert -H|--cache ...
--cachemetadataformat
Specifies the cache metadata format used by cache target.
lvconvert --cachemetadataformat ...
--cachemode
Specifies when writes to a cache LV should be considered complete. writeback considers a write complete as soon as it isstored in the cache pool. writethough considers a write complete only when it has been stored in both the cache pool and onthe origin LV. While writethrough may be slower for writes, it is more resilient if something should happen to a device asso‐ciated with the cache pool LV. With passthrough, all reads are served from the origin LV (all reads miss the cache) and allwrites are forwarded to the origin LV; additionally, write hits cause cache block invalidates. See lvmcache(7) for more infor‐mation.
lvconvert --cachemode ...
--cachepolicy
Specifies the cache policy for a cache LV. See lvmcache(7) for more information.
lvconvert --cachepolicy ...
--cachepool
The name of a cache pool LV.
lvconvert --cachepool ...
--cachesettings
Specifies tunable values for a cache LV in "Key = Value" form. Repeat this option to specify multiple values. (The defaultvalues should usually be adequate.) The special string value default switches settings back to their default kernel valuesand removes them from the list of settings stored in LVM metadata. See lvmcache(7) for more information.
lvconvert --cachesettings ...
-c|--chunksize
The size of chunks in a snapshot, cache pool or thin pool. For snapshots, the value must be a power of 2 between 4KiB and512KiB and the default value is 4. For a cache pool the value must be between 32KiB and 1GiB and the default value is 64.For a thin pool the value must be between 64KiB and 1GiB and the default value starts with 64 and scales up to fit the poolmetadata size within 128MiB, if the pool metadata size is not specified. The value must be a multiple of 64KiB. Seelvmthin(7) and lvmcache(7) for more information.
lvconvert -c|--chunksize ...
--commandprofile
The command profile to use for command configuration. See lvm.conf(5) for more information about profiles.
lvconvert --commandprofile ...
--config
Config settings for the command. These override lvm.conf settings. The String arg uses the same format as lvm.conf, or mayuse section/field syntax. See lvm.conf(5) for more information about config.
lvconvert --config ...
-d|--debug
Set debug level. Repeat from 1 to 6 times to increase the detail of messages sent to the log file and/or syslog (if config‐ured).
lvconvert -d|--debug ...
--discards
Specifies how the device-mapper thin pool layer in the kernel should handle discards. ignore causes the thin pool to ignorediscards. nopassdown causes the thin pool to process discards itself to allow reuse of unneeded extents in the thin pool.passdown causes the thin pool to process discards itself (like nopassdown) and pass the discards to the underlying device.See lvmthin(7) for more information.
lvconvert --discards ...
--driverloaded
If set to no, the command will not attempt to use device-mapper. For testing and debugging.
lvconvert --driverloaded ...
-f|--force
Override various checks, confirmations and protections. Use with extreme caution.
lvconvert -f|--force ...
-h|--help
Display help text.
lvconvert -h|--help ...
-i|--interval
Report progress at regular intervals.
lvconvert -i|--interval ...
--longhelp
Display long help text.
lvconvert --longhelp ...
--merge
An alias for --mergethin, --mergemirrors, or --mergesnapshot, depending on the type of LV.
lvconvert --merge ...
--mergemirrors
Merge LV images that were split from a raid1 LV. See --splitmirrors with --trackchanges.
lvconvert --mergemirrors ...
--mergesnapshot
Merge COW snapshot LV into its origin. When merging a snapshot, if both the origin and snapshot LVs are not open, the mergewill start immediately. Otherwise, the merge will start the first time either the origin or snapshot LV are activated and bothare closed. Merging a snapshot into an origin that cannot be closed, for example a root filesystem, is deferred until the nexttime the origin volume is activated. When merging starts, the resulting LV will have the origin's name, minor number and UUID.While the merge is in progress, reads or writes to the origin appear as being directed to the snapshot being merged. When themerge finishes, the merged snapshot is removed. Multiple snapshots may be specified on the command line or a @tag may be usedto specify multiple snapshots be merged to their respective origin.
lvconvert --mergesnapshot ...
--mergethin
Merge thin LV into its origin LV. The origin thin LV takes the content of the thin snapshot, and the thin snapshot LV isremoved. See lvmthin(7) for more information.
lvconvert --mergethin ...
--metadataprofile
The metadata profile to use for command configuration. See lvm.conf(5) for more information about profiles.
lvconvert --metadataprofile ...
--mirrorlog
Specifies the type of mirror log for LVs with the "mirror" type (does not apply to the "raid1" type.) disk is a persistentlog and requires a small amount of storage space, usually on a separate device from the data being mirrored. core is not per‐sistent; the log is kept only in memory. In this case, the mirror must be synchronized (by copying LV data from the firstdevice to others) each time the LV is activated, e.g. after reboot. mirrored is a persistent log that is itself mirrored, butshould be avoided. Instead, use the raid1 type for log redundancy.
lvconvert --mirrorlog ...
-m|--mirrors
Specifies the number of mirror images in addition to the original LV image, e.g. --mirrors 1 means there are two images of thedata, the original and one mirror image. Optional positional PV args on the command line can specify the devices the imagesshould be placed on. There are two mirroring implementations: "raid1" and "mirror". These are the names of the correspondingLV types, or "segment types". Use the --type option to specify which to use (raid1 is default, and mirror is legacy) Uselvm.conf global/mirror_segtype_default and global/raid10_segtype_default to configure the default types. The plus prefix +can be used, in which case the number is added to the current number of images, or the minus prefix - can be used, in whichcase the number is subtracted from the current number of images. See lvmraid(7) for more information.
lvconvert -m|--mirrors ...
-n|--name
Specifies the name of a new LV. When unspecified, a default name of "lvol#" is generated, where # is a number generated byLVM.
lvconvert -n|--name ...
--noudevsync
Disables udev synchronisation. The process will not wait for notification from udev. It will continue irrespective of any pos‐sible udev processing in the background. Only use this if udev is not running or has rules that ignore the devices LVM cre‐ates.
lvconvert --noudevsync ...
--originname
Specifies the name to use for the external origin LV when converting an LV to a thin LV. The LV being converted becomes aread-only external origin with this name.
lvconvert --originname ...
--poolmetadata
The name of a an LV to use for storing pool metadata.
lvconvert --poolmetadata ...
--poolmetadatasize
Specifies the size of the new pool metadata LV.
lvconvert --poolmetadatasize ...
--poolmetadataspare
Enable or disable the automatic creation and management of a spare pool metadata LV in the VG. A spare metadata LV is reservedspace that can be used when repairing a pool.
lvconvert --poolmetadataspare ...
--profile
An alias for --commandprofile or --metadataprofile, depending on the command.
lvconvert --profile ...
-q|--quiet
Suppress output and log messages. Overrides --debug and --verbose. Repeat once to also suppress any prompts with answer 'no'.
lvconvert -q|--quiet ...
-r|--readahead
Sets read ahead sector count of an LV. auto is the default which allows the kernel to choose a suitable value automatically.none is equivalent to zero.
lvconvert -r|--readahead ...
-R|--regionsize
Size of each raid or mirror synchronization region. lvm.conf activation/raid_region_size can be used to configure a default.
lvconvert -R|--regionsize ...
--repair
Replace failed PVs in a raid or mirror LV, or run a repair utility on a thin pool. See lvmraid(7) and lvmthin(7) for moreinformation.
lvconvert --repair ...
--replace
Replace a specific PV in a raid LV with another PV. The new PV to use can be optionally specified after the LV. Multiple PVscan be replaced by repeating this option. See lvmraid(7) for more information.
lvconvert --replace ...
-s|--snapshot
Combine a former COW snapshot LV with a former origin LV to reverse a previous --splitsnapshot command.
lvconvert -s|--snapshot ...
--splitcache
Separates a cache pool from a cache LV, and keeps the unused cache pool LV. Before the separation, the cache is flushed. Alsosee --uncache.
lvconvert --splitcache ...
--splitmirrors
Splits the specified number of images from a raid1 or mirror LV and uses them to create a new LV. If --trackchanges is alsospecified, changes to the raid1 LV are tracked while the split LV remains detached.
lvconvert --splitmirrors ...
--splitsnapshot
Separates a COW snapshot from its origin LV. The LV that is split off contains the chunks that differ from the origin LV alongwith metadata describing them. This LV can be wiped and then destroyed with lvremove.
lvconvert --splitsnapshot ...
--startpoll
Start polling an LV to continue processing a conversion.
lvconvert --startpoll ...
--stripes
Specifies the number of stripes in a striped LV. This is the number of PVs (devices) that a striped LV is spread across. Datathat appears sequential in the LV is spread across multiple devices in units of the stripe size (see --stripesize). This doesnot apply to existing allocated space, only newly allocated space can be striped.
lvconvert --stripes ...
-I|--stripesize
The amount of data that is written to one device before moving to the next in a striped LV.
lvconvert -I|--stripesize ...
--swapmetadata
Extracts the metadata LV from a pool and replaces it with another specified LV. The extracted LV is preserved and given thename of the LV that replaced it. Use for repair only. When the metadata LV is swapped out of the pool, it can be activateddirectly and used with thin provisioning tools: cache_dump(8), cache_repair(8), cache_restore(8), thin_dump(8),thin_repair(8), thin_restore(8).
lvconvert --swapmetadata ...
-t|--test
Run in test mode. Commands will not update metadata. This is implemented by disabling all metadata writing but neverthelessreturning success to the calling function. This may lead to unusual error messages in multi-stage operations if a tool relieson reading back metadata it believes has changed but hasn't.
lvconvert -t|--test ...
-T|--thin
Specifies the command is handling a thin LV or thin pool. See --type thin, --type thin-pool, and --virtualsize. Seelvmthin(7) for more information about LVM thin provisioning.
lvconvert -T|--thin ...
--thinpool
The name of a thin pool LV.
lvconvert --thinpool ...
--trackchanges
Can be used with --splitmirrors on a raid1 LV. This causes changes to the original raid1 LV to be tracked while the splitimages remain detached. This allows the read-only detached image(s) to be merged efficiently back into the raid1 LV later.Only the regions with changed data are resynchronized during merge. (This option only applies when using the raid1 LV type.)
lvconvert --trackchanges ...
--type
The LV type, also known as "segment type" or "segtype". See usage descriptions for the specific ways to use these types. Formore information about redundancy and performance (raid<N>, mirror, striped, linear) see lvmraid(7). For thin provisioning(thin, thin-pool) see lvmthin(7). For performance caching (cache, cache-pool) see lvmcache(7). For copy-on-write snapshots(snapshot) see usage definitions. Several commands omit an explicit type option because the type is inferred from otheroptions or shortcuts (e.g. --stripes, --mirrors, --snapshot, --virtualsize, --thin, --cache). Use inferred types with carebecause it can lead to unexpected results.
lvconvert --type ...
--uncache
Separates a cache pool from a cache LV, and deletes the unused cache pool LV. Before the separation, the cache is flushed.Also see --splitcache.
lvconvert --uncache ...
--usepolicies
Perform an operation according to the policy configured in lvm.conf or a profile.
lvconvert --usepolicies ...
-v|--verbose
Set verbose level. Repeat from 1 to 4 times to increase the detail of messages sent to stdout and stderr.
lvconvert -v|--verbose ...
--version
Display version information.
lvconvert --version ...
-y|--yes
Do not prompt for confirmation interactively but always assume the answer yes. Use with extreme caution. (For automatic no,see -qq.)
lvconvert -y|--yes ...
-Z|--zero
For snapshots, this controls zeroing of the first 4KiB of data in the snapshot. If the LV is read-only, the snapshot will notbe zeroed. For thin pools, this controls zeroing of provisioned blocks. Provisioning of large zeroed chunks negativelyimpacts performance.VARIABLESVGVolume Group name. See lvm(8) for valid names.LVLogical Volume name. See lvm(8) for valid names. An LV positional arg generally includes the VG name and LV name, e.g.VG/LV. LV followed by _<type> indicates that an LV of the given type is required. (raid represents raid<N> type)PVPhysical Volume name, a device path under /dev. For commands managing physical extents, a PV positional arg generally acceptsa suffix indicating a range (or multiple ranges) of physical extents (PEs). When the first PE is omitted, it defaults to thestart of the device, and when the last PE is omitted it defaults to end. Start and end range (inclusive): PV[:PE-PE]...Start and length range (counting from 0): PV[:PE+PE]...TagTag name. See lvm(8) for information about tag names and using tags in place of a VG, LV or PV.StringSee the option description for information about the string content.Size[UNIT]Size is an input number that accepts an optional unit. Input units are always treated as base two values, regardless of capi‐talization, e.g. 'k' and 'K' both refer to 1024. The default input unit is specified by letter, followed by |UNIT. UNIT rep‐resents other possible input units: bBsSkKmMgGtTpPeE. b|B is bytes, s|S is sectors of 512 bytes, k|K is kilobytes, m|M ismegabytes, g|G is gigabytes, t|T is terabytes, p|P is petabytes, e|E is exabytes. (This should not be confused with the out‐put control --units, where capital letters mean multiple of 1000.)ENVIRONMENT VARIABLESSee lvm(8) for information about environment variables used by lvm. For example, LVM_VG_NAME can generally be substituted for arequired VG parameter.ADVANCED USAGEAlternate command forms, advanced command usage, and listing of all valid syntax for completeness.Convert LV to type mirror (also see type raid1),(also see lvconvert --mirrors).lvconvert --type mirror LV
lvconvert -Z|--zero ...
-
Change the region size of an LV.lvconvert -R|--regionsize Size[m|UNIT] LV_raid[ COMMON_OPTIONS ]
lvconvert - ...