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.

To display the
current LV type, run the command:

lvs −o
name,segtypeLV

In some cases,
an LV is a single device mapper (dm) layer above physical
devices. In other cases, hidden LVs (dm devices) are layered
between the visible LV and physical devices. LVs in the
middle layers are called sub LVs. A command run on a visible
LV sometimes operates on a sub LV rather than the specified
LV. In other cases, a sub LV must be specified directly on
the command line.

Sub LVs can be
displayed with the command:

lvs
−a

The
linear type is equivalent to the striped type
when one stripe exists. In that case, the types can
sometimes be used interchangably.

In most cases,
the mirror type is deprecated and the raid1
type should be used. They are both implementations of
mirroring.

As opposed to
mirroring, raid5 and raid6 stripe data and calculate parity
blocks. The parity blocks can be used for data block
recovery in case devices fail. A maximum number of one
device in a raid5 LV may fail, and two in case of raid6.
Striped raid types typically rotate the parity and data
blocks for performance reasons, thus avoiding contention on
a single device. Specific arrangements of parity and data
blocks (layouts) can be used to optimize I/O performance, or
to convert between raid levels. See lvmraid(7) for
more information.

Layouts
including _n allow for conversion between raid levels
(raid5_n to raid6 or raid5_n to striped/raid0/raid0_meta).
Additionally, special raid6 layouts for raid level
conversions between raid5 and raid6 are: raid6_ls_6,
raid6_rs_6, raid6_la_6 and raid6_ra_6. Those correspond to
their raid5 counterparts (e.g. raid5_rs can be directly
converted to raid6_rs_6 and vice-versa).

raid10 (an
alias for raid10_near) is currently limited to one data copy
and even number of sub LVs. This is a mirror group layout,
thus a single sub LV may fail per mirror group without data
loss.

Striped raid
types support converting the layout, their stripesize and
their number of stripes.

Determines the allocation
policy when a command needs to allocate Physical Extents
(PEs) from the VG. Each VG and LV has an allocation policy
which can be changed with vgchange/lvchange, or overriden on
the command line. normal applies common sense rules
such as not placing parallel stripes on the same PV.
inherit applies the VG policy to an LV.
contiguous requires new PEs be placed adjacent to
existing PEs. cling places new PEs on the same PV as
existing PEs in the same stripe of the LV. If there are
sufficient PEs for an allocation, but normal does not use
them, anywhere will use them even if it reduces
performance, e.g. by placing two stripes on the same PV.
Optional positional PV args on the command line can also be
used to limit which PVs the command will use for allocation.
See lvm(8) for more information about allocation.

−b|−−background

If the operation requires
polling, this option causes the command to return before the
operation is complete, and polling is done in the
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 more information about LVM
caching.

−−cachemetadataformat
auto|1|2

Specifies the cache metadata
format used by cache target.

−−cachemode
writethrough|writeback|passthrough

Specifies when writes to a
cache LV should be considered complete. writeback
considers a write complete as soon as it is stored in the
cache pool. writethough considers a write complete
only when it has been stored in both the cache pool and on
the origin LV. While writethrough may be slower for writes,
it is more resilient if something should happen to a device
associated with the cache pool LV. With passthrough,
all reads are served from the origin LV (all reads miss the
cache) and all writes are forwarded to the origin LV;
additionally, write hits cause cache block invalidates. See
lvmcache(7) for more information.

−−cachepolicyString

Specifies the cache policy for
a cache LV. See lvmcache(7) for more information.

−−cachepoolLV

The name of a cache pool
LV.

−−cachesettingsString

Specifies tunable values for a
cache LV in "Key = Value" form. Repeat this option
to specify multiple values. (The default values should
usually be adequate.) The special string value
default switches settings back to their default
kernel values and removes them from the list of settings
stored in LVM metadata. See lvmcache(7) for more
information.

−c|−−chunksizeSize[k|UNIT]

The size of chunks in a
snapshot, cache pool or thin pool. For snapshots, the value
must be a power of 2 between 4KiB and 512KiB 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 pool metadata size
within 128MiB, if the pool metadata size is not specified.
The value must be a multiple of 64KiB. See lvmthin(7)
and lvmcache(7) for more information.

−−commandprofileString

The command profile to use for
command configuration. See lvm.conf(5) for more
information about profiles.

−−compression
y|n

Controls whether compression is
enabled or disable for VDO volume. See lvmvdo(7) for
more information about VDO usage.

−−configString

Config settings for the
command. These override lvm.conf settings. The String arg
uses the same format as lvm.conf, or may use section/field
syntax. See lvm.conf(5) for more information about
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 configured).

−−deduplication
y|n

Controls whether deduplication
is enabled or disable for VDO volume. See lvmvdo(7)
for more information about VDO usage.

−−discards
passdown|nopassdown|ignore

Specifies how the device-mapper
thin pool layer in the kernel should handle discards.
ignore causes the thin pool to ignore discards.
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.

−−driverloaded
y|n

If set to no, the command will
not attempt to use device-mapper. For testing and
debugging.

−f|−−force
...

Override various checks,
confirmations and protections. Use with extreme caution.

−h|−−help

Display help text.

−i|−−intervalNumber

Report progress at regular
intervals.

−−lockoptString

Used to pass options for
special cases to lvmlockd. See lvmlockd(8) for more
information.

−−longhelp

Display long help text.

−−merge

An alias for
−−mergethin, −−mergemirrors, or
−−mergesnapshot, depending on the type of
LV.

−−mergemirrors

Merge LV images that were split
from a raid1 LV. See −−splitmirrors with
−−trackchanges.

−−mergesnapshot

Merge COW snapshot LV into its
origin. When merging a snapshot, if both the origin and
snapshot LVs are not open, the merge will start immediately.
Otherwise, the merge will start the first time either the
origin or snapshot LV are activated and both are closed.
Merging a snapshot into an origin that cannot be closed, for
example a root filesystem, is deferred until the next time
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 the merge finishes, the merged snapshot is
removed. Multiple snapshots may be specified on the command
line or a @tag may be used to specify multiple snapshots be
merged to their respective origin.

−−mergethin

Merge thin LV into its origin
LV. The origin thin LV takes the content of the thin
snapshot, and the thin snapshot LV is removed. See
lvmthin(7) for more information.

−−metadataprofileString

The metadata profile to use for
command configuration. See lvm.conf(5) for more
information about profiles.

−−mirrorlog
core|disk

Specifies the type of mirror
log for LVs with the "mirror" type (does not apply
to the "raid1" type.) disk is a persistent
log and requires a small amount of storage space, usually on
a separate device from the data being mirrored. core
is not persistent; the log is kept only in memory. In this
case, the mirror must be synchronized (by copying LV data
from the first device to others) each time the LV is
activated, e.g. after reboot. mirrored is a
persistent log that is itself mirrored, but should be
avoided. Instead, use the raid1 type for log redundancy.

−m|−−mirrors
[+|−]Number

Specifies the number of mirror
images in addition to the original LV image, e.g.
−−mirrors 1 means there are two images of the
data, the original and one mirror image. Optional positional
PV args on the command line can specify the devices the
images should be placed on. There are two mirroring
implementations: "raid1" and "mirror".
These are the names of the corresponding LV types, or
"segment types". Use the −−type option
to specify which to use (raid1 is default, and mirror is
legacy) Use lvm.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 which case the
number is subtracted from the current number of images. See
lvmraid(7) for more information.

−n|−−nameString

Specifies the name of a new LV.
When unspecified, a default name of "lvol#" is
generated, where # is a number generated by LVM.

−−nolocking

Disable locking.

−−noudevsync

Disables udev synchronisation.
The process will not wait for notification from udev. It
will continue irrespective of any possible udev processing
in the background. Only use this if udev is not running or
has rules that ignore the devices LVM creates.

−−originnameLV

Specifies the name to use for
the external origin LV when converting an LV to a thin LV.
The LV being converted becomes a read-only external origin
with this name.

−−poolmetadataLV

The name of a an LV to use for
storing pool metadata.

−−poolmetadatasizeSize[m|UNIT]

Specifies the size of the new
pool metadata LV.

−−poolmetadataspare
y|n

Enable or disable the automatic
creation and management of a spare pool metadata LV in the
VG. A spare metadata LV is reserved space that can be used
when repairing a pool.

−−profileString

An alias for
−−commandprofile or
−−metadataprofile, depending on the command.

−q|−−quiet
...

Suppress output and log
messages. Overrides −−debug and
−−verbose. Repeat once to also suppress any
prompts with answer ’no’.

−r|−−readahead
auto|none|Number

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.

−R|−−regionsizeSize[m|UNIT]

Size of each raid or mirror
synchronization region. lvm.conf activation/raid_region_size
can be used to configure a default.

−−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 more
information.

−−replacePV

Replace a specific PV in a raid
LV with another PV. The new PV to use can be optionally
specified after the LV. Multiple PVs can be replaced by
repeating this option. See lvmraid(7) for more
information.

−s|−−snapshot

Combine a former COW snapshot
LV with a former origin LV to reverse a previous
−−splitsnapshot command.

−−splitcache

Separates a cache pool from a
cache LV, and keeps the unused cache pool LV. Before the
separation, the cache is flushed. Also see
−−uncache.

−−splitmirrorsNumber

Splits the specified number of
images from a raid1 or mirror LV and uses them to create a
new LV. If −−trackchanges is also specified,
changes to the raid1 LV are tracked while the split LV
remains detached. If −−name is specified, then
the images are permanently split from the original LV and
changes are not tracked.

−−splitsnapshot

Separates a COW snapshot from
its origin LV. The LV that is split off contains the chunks
that differ from the origin LV along with metadata
describing them. This LV can be wiped and then destroyed
with lvremove.

−−startpoll

Start polling an LV to continue
processing a conversion.

−−stripesNumber

Specifies the number of stripes
in a striped LV. This is the number of PVs (devices) that a
striped LV is spread across. Data that appears sequential in
the LV is spread across multiple devices in units of the
stripe size (see −−stripesize). This does not
apply to existing allocated space, only newly allocated
space can be striped.

−I|−−stripesizeSize[k|UNIT]

The amount of data that is
written to one device before moving to the next in a striped
LV.

Run in test mode. Commands will
not update metadata. This is implemented by disabling all
metadata writing but nevertheless returning success to the
calling function. This may lead to unusual error messages in
multi-stage operations if a tool relies on reading back
metadata it believes has changed but hasn’t.

−T|−−thin

Specifies the command is
handling a thin LV or thin pool. See −−type
thin, −−type thin−pool, and
−−virtualsize. See lvmthin(7) for more
information about LVM thin provisioning.

−−thinpoolLV

The name of a thin pool LV.

−−trackchanges

Can be used with
−−splitmirrors on a raid1 LV. This causes
changes to the original raid1 LV to be tracked while the
split images remain detached. This is a temporary state that
allows the read-only detached image to be merged efficiently
back into the raid1 LV later. Only the regions with changed
data are resynchronized during merge. While a raid1 LV is
tracking changes, operations on it are limited to merging
the split image (see −−mergemirrors) or
permanently splitting the image (see
−−splitmirrors with −−name.

The LV type, also known as
"segment type" or "segtype". See usage
descriptions for the specific ways to use these types. For
more 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 other options or shortcuts
(e.g. −−stripes, −−mirrors,
−−snapshot, −−virtualsize,
−−thin, −−cache). Use inferred types
with care because it can lead to unexpected results.

−−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.

−−usepolicies

Perform an operation according
to the policy configured in lvm.conf or a profile.

−−vdopoolLV

The name of a VDO pool LV. See
lvmvdo(7) for more information about VDO usage.

−v|−−verbose
...

Set verbose level. Repeat from
1 to 4 times to increase the detail of messages sent to
stdout and stderr.

−−version

Display version
information.

−V|−−virtualsizeSize[m|UNIT]

The virtual size of a new thin
LV. See lvmthin(7) for more information about LVM
thin provisioning. Using virtual size (−V) and actual
size (−L) together creates a sparse LV. lvm.conf
global/sparse_segtype_default determines the default segment
type used to create a sparse LV. Anything written to a
sparse LV will be returned when reading from it. Reading
from other areas of the LV will return blocks of zeros. When
using a snapshot to create a sparse LV, a hidden virtual
device is created using the zero target, and the LV has the
suffix _vorigin. Snapshots are less efficient than thin
provisioning when creating large sparse LVs (GiB).

−y|−−yes

Do not prompt for confirmation
interactively but always assume the answer yes. Use with
extreme caution. (For automatic no, see −qq.)

−Z|−−zero
y|n

For snapshots, this controls
zeroing of the first 4KiB of data in the snapshot. If the LV
is read-only, the snapshot will not be zeroed. For thin
pools, this controls zeroing of provisioned blocks.
Provisioning of large zeroed chunks negatively impacts
performance.

Logical 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)

PV

Physical Volume name, a device
path under /dev. For commands managing physical extents, a
PV positional arg generally accepts a suffix indicating a
range (or multiple ranges) of physical extents (PEs). When
the first PE is omitted, it defaults to the start 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]...

Tag

Tag name. See lvm(8) for
information about tag names and using tags in place of a VG,
LV or PV.

String

See 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 capitalization, e.g.
’k’ and ’K’ both refer to 1024. The
default input unit is specified by letter, followed by
|UNIT. UNIT represents other possible input units:
bBsSkKmMgGtTpPeE. b|B is bytes, s|S is sectors of 512
bytes, k|K is kilobytes, m|M is megabytes, g|G is gigabytes,
t|T is terabytes, p|P is petabytes, e|E is exabytes. (This
should not be confused with the output control
−−units, where capital letters mean multiple of
1000.)

This previous
command syntax would perform two different operations:
lvconvert −−thinpoolLV1−−poolmetadataLV2
If LV1 was not a thin pool, the command would convert LV1 to
a thin pool, optionally using a specified LV for metadata.
But, if LV1 was already a thin pool, the command would swap
the current metadata LV with LV2 (for repair purposes.)

In the same
way, this previous command syntax would perform two
different operations:
lvconvert −−cachepoolLV1−−poolmetadataLV2
If LV1 was not a cache pool, the command would convert LV1
to a cache pool, optionally using a specified LV for
metadata. But, if LV1 was already a cache pool, the command
would swap the current metadata LV with LV2 (for repair
purposes.)

Convert an LV
into a thin LV in the specified thin pool. The existing LV
is used as an external read-only origin for the new thin LV.
lvconvert −−type thin −−thinpool
vg/tpool1 vg/lvol1

Convert an LV
into a thin LV in the specified thin pool. The existing LV
is used as an external read-only origin for the new thin LV,
and is renamed "external".
lvconvert −−type thin −−thinpool
vg/tpool1