lvconvert (8) - Linux Manuals
lvconvert: Change logical volume layout
NAME
lvconvert - Change logical volume layout
SYNOPSIS
lvconvert option_args position_args
To display the current LV type, run the command:
lvs -o name,segtype
LV
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.
Striped raid types are
raid0/raid0_meta,
raid5 (an alias for raid5_ls),
raid6 (an alias for raid6_zr) and
raid10 (an alias for raid10_near).
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 of raid5 rotating parity blocks can be: left-asymmetric
(raid5_la), left-symmetric (raid5_ls with alias raid5), right-asymmetric
(raid5_ra), right-symmetric (raid5_rs) and raid5_n, which doesn't rotate
parity blocks. Layouts of raid6 are: zero-restart (raid6_zr with alias
raid6), next-restart (raid6_nr), and next-continue (raid6_nc).
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.
The striped raid types combined with raid1 allow for conversion from
linear-> striped/raid0/raid0_meta and vice-versa by e.g. linear <-> raid1
<-> raid5_n (then adding stripes) <-> striped/raid0/raid0_meta.
lvconvert --type linear LV
Convert LV to striped.
lvconvert --type striped LV
Convert LV to type mirror (also see type raid1),
lvconvert --type mirror LV
Convert LV to raid or change raid layout
lvconvert --type raid LV
Convert LV to raid1 or mirror, or change number of mirror images.
lvconvert -m|--mirrors [+|-]Number LV
Convert raid LV to change number of stripe images.
lvconvert --stripes Number LV_raid
Convert raid LV to change the stripe size.
lvconvert -I|--stripesize Size[k|UNIT] LV_raid
Split images from a raid1 or mirror LV and use them to create a new LV.
lvconvert --splitmirrors Number -n|--name LV_new LV_cache_mirror_raid1
Split images from a raid1 LV and track changes to origin for later merge.
lvconvert --splitmirrors Number --trackchanges LV_cache_raid1
Merge LV images that were split from a raid1 LV.
lvconvert --mergemirrors VG|LV_linear_raid|Tag ...
Convert LV to a thin LV, using the original LV as an external origin.
lvconvert --type thin --thinpool LV LV_linear_striped_thin_cache_raid
Attach a cache pool to an LV, converts the LV to type cache.
lvconvert --type cache --cachepool LV LV_linear_striped_thinpool_vdo_vdopool_vdopooldata_raid
Attach a writecache to an LV, converts the LV to type writecache.
lvconvert --type writecache --cachevol LV LV_linear_striped_raid
Attach a cache to an LV, converts the LV to type cache.
lvconvert --type cache --cachevol LV LV_linear_striped_thinpool_raid
Convert LV to type thin-pool.
lvconvert --type thin-pool LV_linear_striped_cache_raid
Convert LV to type cache-pool.
lvconvert --type cache-pool LV_linear_striped_raid
Convert LV to type vdopool.
lvconvert --type vdo-pool LV_linear_striped_cache_raid
Detach a cache from an LV.
lvconvert --splitcache LV_thinpool_cache_cachepool_vdopool_writecache
Merge thin LV into its origin LV.
lvconvert --mergethin LV_thin ...
Merge COW snapshot LV into its origin.
lvconvert --mergesnapshot LV_snapshot ...
Combine a former COW snapshot (second arg) with a former
lvconvert --type snapshot LV LV_linear_striped
Replace failed PVs in a raid or mirror LV.
lvconvert --repair LV_thinpool_cache_cachepool_mirror_raid
Replace specific PV(s) in a raid LV with another PV.
lvconvert --replace PV LV_raid
Poll LV to continue conversion.
lvconvert --startpoll LV_mirror_raid
Common options for command:
Common options for lvm:
Change the region size of an LV.
lvconvert -R|--regionsize Size[m|UNIT] LV_raid
Change the type of mirror log used by a mirror LV.
lvconvert --mirrorlog core|disk LV_mirror
Convert LV to a thin LV, using the original LV as an external origin
lvconvert -T|--thin --thinpool LV LV_linear_striped_thin_cache_raid
Attach a cache pool to an LV (infers --type cache).
lvconvert -H|--cache --cachepool LV LV_linear_striped_thinpool_vdo_vdopool_vdopooldata_raid
Attach a cache to an LV, converts the LV to type cache.
lvconvert -H|--cache --cachevol LV LV_linear_striped_thinpool_raid
Convert LV to type vdopool.
lvconvert --vdopool LV_linear_striped_cache_raid
Detach and delete a cache from an LV.
lvconvert --uncache LV_thinpool_cache_vdopool_writecache
Swap metadata LV in a thin pool or cache pool (for repair only).
lvconvert --swapmetadata --poolmetadata LV LV_thinpool_cachepool
Merge LV that was split from a mirror (variant, use --mergemirrors).
lvconvert --merge VG|LV_linear_striped_snapshot_thin_raid|Tag ...
Separate a COW snapshot from its origin LV.
lvconvert --splitsnapshot LV_snapshot
Combine a former COW snapshot (second arg) with a former
lvconvert -s|--snapshot LV LV_linear_striped
Poll LV to continue conversion (also see --startpoll)
lvconvert LV_mirror_raid
In the same way, this previous command syntax would perform two different
operations:
Convert a linear LV to a two-way RAID1 LV.
Convert a mirror LV to use an in-memory log.
Convert a mirror LV to use a disk log.
Convert a mirror or raid1 LV to a linear LV.
Convert a mirror LV to a raid1 LV with the same number of images.
Convert a linear LV to a two-way mirror LV, allocating new extents from specific
PV ranges.
Convert a mirror LV to a linear LV, freeing physical extents from a specific PV.
Split one image from a mirror or raid1 LV, making it a new LV.
Split one image from a raid1 LV, and track changes made to the raid1 LV
while the split image remains detached.
Merge an image (that was previously created with --splitmirrors and
--trackchanges) back into the original raid1 LV.
Replace PV /dev/sdb1 with PV /dev/sdf1 in a raid1/4/5/6/10 LV.
Replace 3 PVs /dev/sd[b-d]1 with PVs /dev/sd[f-h]1 in a raid1 LV.
Replace the maximum of 2 PVs /dev/sd[bc]1 with PVs /dev/sd[gh]1 in a raid6 LV.
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.
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".
Convert an LV to a cache pool LV using another specified LV for cache pool
metadata.
Convert an LV to a cache LV using the specified cache pool and chunk size.
Detach and keep the cache pool from a cache LV.
Detach and remove the cache pool from a cache LV.
lvm(8)
lvm.conf(5)
lvmconfig(8)
pvchange(8)
pvck(8)
pvcreate(8)
pvdisplay(8)
pvmove(8)
pvremove(8)
pvresize(8)
pvs(8)
pvscan(8)
vgcfgbackup(8)
vgcfgrestore(8)
vgchange(8)
vgck(8)
vgcreate(8)
vgconvert(8)
vgdisplay(8)
vgexport(8)
vgextend(8)
vgimport(8)
vgimportclone(8)
vgmerge(8)
vgmknodes(8)
vgreduce(8)
vgremove(8)
vgrename(8)
vgs(8)
vgscan(8)
vgsplit(8)
lvcreate(8)
lvchange(8)
lvconvert(8)
lvdisplay(8)
lvextend(8)
lvreduce(8)
lvremove(8)
lvrename(8)
lvresize(8)
lvs(8)
lvscan(8)
lvm-fullreport(8)
lvm-lvpoll(8)
lvm2-activation-generator(8)
blkdeactivate(8)
lvmdump(8)
dmeventd(8)
lvmpolld(8)
lvmlockd(8)
lvmlockctl(8)
cmirrord(8)
lvmdbusd(8)
lvmsystemid(7)
lvmreport(7)
lvmraid(7)
lvmthin(7)
lvmcache(7)
-b|--background
-H|--cache
-c|--chunksize Size[k|UNIT]
-d|--debug
-f|--force
-h|--help
-i|--interval Number
-m|--mirrors [+|-]Number
-n|--name String
-q|--quiet
-r|--readahead auto|none|Number
-R|--regionsize Size[m|UNIT]
-s|--snapshot
-I|--stripesize Size[k|UNIT]
-t|--test
-T|--thin
-v|--verbose
-V|--virtualsize Size[m|UNIT]
-y|--yes
-Z|--zero y|n
DESCRIPTION
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
Convert LV to linear.
-
[ -R|--regionsize Size[m|UNIT] ]
[ -i|--interval Number ]
[ --stripes Number ]
[ COMMON_OPTIONS ]
-
[ -I|--stripesize Size[k|UNIT] ]
[ -R|--regionsize Size[m|UNIT] ]
[ -i|--interval Number ]
[ --stripes Number ]
[ --mirrorlog core|disk ]
[ COMMON_OPTIONS ]
-
(a specific raid level must be used, e.g. raid1).
[ -I|--stripesize Size[k|UNIT] ]
[ -R|--regionsize Size[m|UNIT] ]
[ -i|--interval Number ]
[ --stripes Number ]
[ COMMON_OPTIONS ]
-
[ -i|--interval Number ]
[ --mirrorlog core|disk ]
[ COMMON_OPTIONS ]
-
[ -R|--regionsize Size[m|UNIT] ]
[ -I|--stripesize Size[k|UNIT] ]
[ COMMON_OPTIONS ]
-
[ -R|--regionsize Size[m|UNIT] ]
[ COMMON_OPTIONS ]
-
-
-
-
[ -r|--readahead auto|none|Number ]
[ -c|--chunksize Size[k|UNIT] ]
[ -Z|--zero y|n ]
[ --originname LV_new ]
[ --poolmetadata LV ]
[ --poolmetadatasize Size[m|UNIT] ]
[ --poolmetadataspare y|n ]
[ --metadataprofile String ]
[ COMMON_OPTIONS ]
-
[ -Z|--zero y|n ]
[ -r|--readahead auto|none|Number ]
[ -c|--chunksize Size[k|UNIT] ]
[ --cachemetadataformat auto|1|2 ]
[ --cachemode writethrough|writeback|passthrough ]
[ --cachepolicy String ]
[ --cachesettings String ]
[ --poolmetadata LV ]
[ --poolmetadatasize Size[m|UNIT] ]
[ --poolmetadataspare y|n ]
[ --metadataprofile String ]
[ COMMON_OPTIONS ]
-
[ COMMON_OPTIONS ]
-
[ -Z|--zero y|n ]
[ -c|--chunksize Size[k|UNIT] ]
[ --cachemetadataformat auto|1|2 ]
[ --cachemode writethrough|writeback|passthrough ]
[ --cachepolicy String ]
[ --cachesettings String ]
[ --poolmetadatasize Size[m|UNIT] ]
[ COMMON_OPTIONS ]
-
[ -r|--readahead auto|none|Number ]
[ -c|--chunksize Size[k|UNIT] ]
[ -Z|--zero y|n ]
[ --stripes Number ]
[ --discards passdown|nopassdown|ignore ]
[ --poolmetadata LV ]
[ --poolmetadatasize Size[m|UNIT] ]
[ --poolmetadataspare y|n ]
[ --metadataprofile String ]
[ COMMON_OPTIONS ]
-
[ -r|--readahead auto|none|Number ]
[ -c|--chunksize Size[k|UNIT] ]
[ --cachemetadataformat auto|1|2 ]
[ --cachemode writethrough|writeback|passthrough ]
[ --cachepolicy String ]
[ --cachesettings String ]
[ --poolmetadata LV ]
[ --poolmetadatasize Size[m|UNIT] ]
[ --poolmetadataspare y|n ]
[ --metadataprofile String ]
[ COMMON_OPTIONS ]
-
[ -V|--virtualsize Size[m|UNIT] ]
[ --compression y|n ]
[ --deduplication y|n ]
[ COMMON_OPTIONS ]
-
-
-
[ COMMON_OPTIONS ]
-
origin LV (first arg) to reverse a splitsnapshot command.
[ -c|--chunksize Size[k|UNIT] ]
[ -Z|--zero y|n ]
[ COMMON_OPTIONS ]
-
Repair a thin pool.
Repair a cache pool.
[ --usepolicies ]
[ --poolmetadataspare y|n ]
[ COMMON_OPTIONS ]
-
-
-
[ -f|--force ]
[ --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit ]
[ --noudevsync ]
[ -h|--help ]
[ -q|--quiet ]
[ -t|--test ]
[ -v|--verbose ]
[ -y|--yes ]
[ --commandprofile String ]
[ --config String ]
[ --driverloaded y|n ]
[ --lockopt String ]
[ --longhelp ]
[ --nolocking ]
[ --profile String ]
[ --version ]
OPTIONS
VARIABLES
ENVIRONMENT VARIABLES
See lvm(8) for information about environment variables used by lvm.
For example, LVM_VG_NAME can generally be substituted for a required VG parameter.
ADVANCED USAGE
Alternate command forms, advanced command usage, and listing of all valid syntax for completeness.
-
-
(infers --type thin).
[ -c|--chunksize Size[k|UNIT] ]
[ -Z|--zero y|n ]
[ --type thin ]
[ --originname LV_new ]
[ --poolmetadata LV ]
[ --poolmetadatasize Size[m|UNIT] ]
[ --poolmetadataspare y|n ]
[ --metadataprofile String ]
[ COMMON_OPTIONS ]
-
[ -r|--readahead auto|none|Number ]
[ -c|--chunksize Size[k|UNIT] ]
[ --type cache ]
[ --cachemetadataformat auto|1|2 ]
[ --cachemode writethrough|writeback|passthrough ]
[ --cachepolicy String ]
[ --cachesettings String ]
[ --poolmetadata LV ]
[ --poolmetadatasize Size[m|UNIT] ]
[ --poolmetadataspare y|n ]
[ --metadataprofile String ]
[ COMMON_OPTIONS ]
-
[ -c|--chunksize Size[k|UNIT] ]
[ --cachemetadataformat auto|1|2 ]
[ --cachemode writethrough|writeback|passthrough ]
[ --cachepolicy String ]
[ --cachesettings String ]
[ --poolmetadatasize Size[m|UNIT] ]
[ COMMON_OPTIONS ]
-
[ -V|--virtualsize Size[m|UNIT] ]
[ --type vdo-pool ]
[ --compression y|n ]
[ --deduplication y|n ]
[ COMMON_OPTIONS ]
-
-
[ COMMON_OPTIONS ]
-
Merge thin LV into its origin LV (variant, use --mergethin).
Merge COW snapshot LV into its origin (variant, use --mergesnapshot).
[ COMMON_OPTIONS ]
-
-
origin LV (first arg) to reverse a splitsnapshot command.
[ -Z|--zero y|n ]
[ --type snapshot ]
[ COMMON_OPTIONS ]
-
or waits till conversion/mirror syncing is finished
-
NOTES
This previous command syntax would perform two different operations:
lvconvert --thinpool LV1 --poolmetadata LV2
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.)
lvconvert --cachepool LV1 --poolmetadata LV2
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.)
EXAMPLES
Convert a linear LV to a two-way mirror LV.
lvconvert --type mirror --mirrors 1 vg/lvol1
lvconvert --type raid1 --mirrors 1 vg/lvol1
lvconvert --mirrorlog core vg/lvol1
lvconvert --mirrorlog disk vg/lvol1
lvconvert --type linear vg/lvol1
lvconvert --type raid1 vg/lvol1
lvconvert --mirrors 1 vg/lvol1 /dev/sda:0-15 /dev/sdb:0-15
lvconvert --type linear vg/lvol1 /dev/sda
lvconvert --splitmirrors 1 --name lv_split vg/lvol1
lvconvert --splitmirrors 1 --trackchanges vg/lvol1
lvconvert --mergemirrors vg/lvol1_rimage_1
lvconvert --replace /dev/sdb1 vg/lvol1 /dev/sdf1
lvconvert --replace /dev/sdb1 --replace /dev/sdc1 --replace /dev/sdd1
lvconvert --replace /dev/sdb1 --replace /dev/sdc1 vg/lvol1 /dev/sd[gh]1
lvconvert --type thin --thinpool vg/tpool1 vg/lvol1
lvconvert --type thin --thinpool vg/tpool1
lvconvert --type cache-pool --poolmetadata vg/poolmeta1 vg/lvol1
lvconvert --type cache --cachepool vg/cpool1 -c 128 vg/lvol1
lvconvert --splitcache vg/lvol1
lvconvert --uncache vg/lvol1
SEE ALSO