]> sourceware.org Git - lvm2.git/blame - man/lvconvert.8.in
spacing
[lvm2.git] / man / lvconvert.8.in
CommitLineData
5951ef33 1.TH LVCONVERT 8 "LVM TOOLS #VERSION#" "Red Hat, Inc" \" -*- nroff -*-
48432c88 2.SH NAME
e0096cab 3lvconvert \- convert a logical volume from linear to mirror or snapshot
48432c88
AK
4.SH SYNOPSIS
5.B lvconvert
c63b155d
ZK
6.BR \-m | \-\-mirrors
7.I Mirrors
8.RB [ \-\-mirrorlog
9.RI { disk | core | mirrored }]
10.RB [ \-\-corelog ]
11.RB [ \-R | \-\-regionsize
12.IR MirrorLogRegionSize ]
13.RB [ \-\-type
14.IR SegmentType ]
15.RB [ \-A | \-\-alloc
16.IR AllocationPolicy ]
17.RB [ \-b | \-\-background ]
18.RB [ \-f | \-\-force ]
19.RB [ \-i | \-\-interval
20.IR Seconds ]
21.RB [ \-h | \-? | \-\-help ]
22.RB [ \-\-stripes
23.I Stripes
24.RB [ \-I | \-\-stripesize
25.IR StripeSize ]]
26.RB [ \-\-noudevsync ]
27.RB [ \-v | \-\-verbose ]
28.RB [ \-y | \-\-yes ]
29.RB [ \-\-version ]
30.IR LogicalVolume [ Path ]
31.RI [ PhysicalVolume [ Path ][ :PE [ -PE ]]...]
32.sp
33.B lvconvert \-\-splitmirrors \fIImages
34.RB [ \-\-name
35.IR SplitLogicalVolumeName ]
36.RB [ \-\-trackchanges ]
37.IR MirrorLogicalVolume [ Path ]
38.RI [ SplittablePhysicalVolume [ Path ][ :PE [ -PE ]]...]
39.sp
e516e070 40.B lvconvert
c63b155d
ZK
41.BR \-s | \-\-snapshot
42.RB [ \-c | \-\-chunksize
43.IR ChunkSize ]
44.RB [ \-h | \-? | \-\-help ]
45.RB [ \-\-noudevsync ]
46.RB [ \-v | \-\-verbose ]
47.RB [ \-Z | \-\-zero
48.RI { y | n }]
49.RB [ \-\-version ]
50.IR OriginalLogicalVolume [ Path ]
51.IR SnapshotLogicalVolume [ Path ]
52.sp
53.B lvconvert \-\-merge
54.RB [ \-b | \-\-background ]
55.RB [ \-i | \-\-interval
56.IR Seconds ]
57.RB [ \-h | \-? | \-\-help ]
58.RB [ \-v | \-\-verbose ]
59.RB [ \-\-version ]
60.IR LogicalVolume [ Path ]...
61.sp
62.B lvconvert \-\-repair
63.RB [ \-h | \-? | \-\-help ]
64.RB [ \-v | \-\-verbose ]
65.RB [ \-\-version ]
66.IR LogicalVolume [ Path ]
67.RI [ PhysicalVolume [ Path ]...]
68.sp
69.B lvconvert \-\-replace \fIPhysicalVolume
70.RB [ \-h | \-? | \-\-help ]
71.RB [ \-v | \-\-verbose ]
72.RB [ \-\-version ]
73.IR LogicalVolume [ Path ]
74.RI [ PhysicalVolume [ Path ]...]
0c506d9a 75
48432c88 76.SH DESCRIPTION
63bd9ec3
JEB
77lvconvert is used to change the segment type (i.e. linear, mirror, etc) or
78characteristics of a logical volume. For example, it can add or remove the
79redundant images of a logical volume, change the log type of a mirror, or
80designate a logical volume as a snapshot repository.
23087fc9
DW
81.br
82If the conversion requires allocation of physical extents (for
83example, when converting from linear to mirror) and you specify
84one or more PhysicalVolumes (optionally with ranges of physical
85extents), allocation of physical extents will be restricted to
86these physical extents. If the conversion frees physical extents
87(for example, when converting from a mirror to a linear, or reducing
88mirror legs) and you specify one or more PhysicalVolumes,
89the freed extents come first from the specified PhysicalVolumes.
48432c88 90.SH OPTIONS
c63b155d 91See \fBlvm\fP(8) for common options.
e0096cab 92.br
c63b155d
ZK
93Exactly one of
94.BR \-\-splitmirrors ", " \-\-mirrors ", " \-\-repair ", " \-\-snapshot
95or \fB\-\-merge\fP arguments is required.
48432c88 96.TP
c63b155d 97.BR \-m ", " \-\-mirrors " " \fIMirrors
48432c88 98Specifies the degree of the mirror you wish to create.
c63b155d 99For example, "\fB-m 1\fP" would convert the original logical
48432c88
AK
100volume to a mirror volume with 2-sides; that is, a
101linear volume plus one copy.
102.TP
c63b155d 103.IR \fB\-\-mirrorlog " {" disk | core | mirrored }
230948b9
AK
104Specifies the type of log to use.
105The default is disk, which is persistent and requires
106a small amount of storage space, usually on a separate device
107from the data being mirrored.
108Core may be useful for short-lived mirrors: It means the mirror is
109regenerated by copying the data from the first device again every
110time the device is activated - perhaps, for example, after every reboot.
7a369d37 111Using "mirrored" will create a persistent log that is itself mirrored.
a6d4f21c 112.TP
c63b155d
ZK
113.B \-\-corelog
114The optional argument \fB--corelog\fP is the same as specifying
115\fB--mirrorlog core\fP.
705eabf7 116.TP
c63b155d 117.BR \-R ", " \-\-regionsize " " \fIMirrorLogRegionSize
705eabf7
AK
118A mirror is divided into regions of this size (in MB), and the mirror log
119uses this granularity to track which regions are in sync.
ba0c495d 120.TP
c63b155d 121.B \-\-type \fISegmentType
e4eaed81 122Used to convert a logical volume to another segment type or to explicitly state
c63b155d
ZK
123the desired RAID1 segment type (\fImirror\fP or \fIraid1\fP) when converting
124a linear logical volume to a mirror with the \fB-m\fP argument.
e4eaed81 125.TP
c63b155d 126.BR \-b ", " \-\-background
ba0c495d
AK
127Run the daemon in the background.
128.TP
c63b155d 129.BR \-i ", " \-\-interval " " \fISeconds
ba0c495d 130Report progress as a percentage at regular intervals.
e0096cab 131.TP
c63b155d 132.B \-\-noudevsync
c48b1005
PR
133Disable udev synchronisation. The
134process will not wait for notification from udev.
135It will continue irrespective of any possible udev processing
136in the background. You should only use this if udev is not running
137or has rules that ignore the devices LVM2 creates.
138.TP
c63b155d 139.B \-\-splitmirrors \fIImages
72e07436
JEB
140The number of redundant Images of a mirror to be split off and used
141to form a new logical volume. A name must be supplied for the
c63b155d
ZK
142newly-split-off logical volume using the \fB\-\-name\fP argument, unless
143the \fB\-\-trackchanges\fP argument is given.
72e07436 144.TP
c63b155d 145.B \-n \fIName
72e07436
JEB
146The name to apply to a logical volume which has been split off from
147a mirror logical volume.
6d04311e 148.TP
c63b155d
ZK
149.B \-\-trackchanges
150Used with \fB\-\-splitmirrors\fP on a raid1 device, this tracks changes so
151that the read-only detached image can be merged efficiently back into
152the mirror later. Only the regions of the detatched device where
153the data changed get resynchronized.
d854bae8
AK
154
155Please note that this feature is only supported with the new md-based mirror
156implementation and not with the original device-mapper mirror implementation.
eb23252b 157.TP
c63b155d 158.B \-s, \-\-snapshot
e0096cab
MB
159Create a snapshot from existing logical volume using another
160existing logical volume as its origin.
161.TP
c63b155d
ZK
162.BR \-c ", " \-\-chunksize " " \fIChunkSize
163Power of 2 chunk size for the snapshot logical volume between 4KiB and 512KiB.
e0096cab 164.TP
c63b155d 165.BR \-Z ", " \-\-zero " {" \fIy | \fIn }
e0096cab 166Controls zeroing of the first KB of data in the snapshot.
fb12fd44 167If the volume is read-only the snapshot will not be zeroed.
a39ac3e1 168.TP
c63b155d 169.B \-\-merge
d854bae8 170Merges a snapshot into its origin volume or merges a raid1 image that has
c63b155d 171been split from its mirror with \fB\-\-trackchanges\fP back into its mirror.
a2facf4a
JEB
172
173To check if your kernel supports the snapshot merge feature, look
174for 'snapshot-merge' in the output
c63b155d 175of \fBdmsetup targets\fP. If both the origin and snapshot volume are not
9443b5d4 176open the merge will start immediately. Otherwise, the merge will start
a39ac3e1
MS
177the first time either the origin or snapshot are activated and both are closed.
178Merging a snapshot into an origin that cannot be closed, for example a root
179filesystem, is deferred until the next time the origin volume is activated.
180When merging starts, the resulting logical volume will have the origin's name,
181minor number and UUID. While the merge is in progress, reads or writes to the
182origin appear as they were directed to the snapshot being merged. When the
234b1248
MS
183merge finishes, the merged snapshot is removed. Multiple snapshots may
184be specified on the commandline or a @tag may be used to specify
185multiple snapshots be merged to their respective origin.
72e07436 186.TP
c63b155d 187.B \-\-repair
72e07436
JEB
188Repair a mirror after suffering a disk failure. The mirror will be brought back
189into a consistent state. By default, the original number of mirrors will be
c63b155d
ZK
190restored if possible. Specify \fB\-y\fP on the command line to skip
191the prompts. Use \fB\-f\fP if you do not want any replacement.
192Additionally, you may use \fB\-\-use-policies\fP to use the device
193replacement policy specified in \fBlvm.conf\fP(5),
72e07436
JEB
194viz. activation/mirror_log_fault_policy or
195activation/mirror_device_fault_policy.
0c506d9a 196.TP
c63b155d
ZK
197.B \-\-replace \fIPhysicalVolume
198Remove the specified device (\fIPhysicalVolume\fP) and replace it with one
199that is available in the volume group or from the specific list provided.
200This option is only available to RAID segment types
201(e.g. "raid1", "raid5", etc).
0c506d9a 202
48432c88 203.SH Examples
c63b155d
ZK
204Converts the linear logical volume "vg00/lvol1" to a two-way mirror
205logical volume:
206.sp
207.B lvconvert \-m1 vg00/lvol1
48432c88 208
c63b155d
ZK
209Converts the linear logical volume "vg00/lvol1" to a two-way RAID1
210logical volume:
211.sp
212.B lvconvert \-\-type raid1 \-m1 vg00/lvol1
19583d11 213
c63b155d
ZK
214Converts a mirror with a disk log to a mirror with an in-memory log:
215.sp
216.B lvconvert \-\-mirrorlog core vg00/lvol1
48432c88 217
c63b155d
ZK
218Converts a mirror with an in-memory log to a mirror with a disk log:
219.sp
220.B lvconvert \-\-mirrorlog disk vg00/lvol1
e0096cab 221
c63b155d
ZK
222Converts a mirror logical volume to a linear logical volume:
223.sp
224.B lvconvert \-m0 vg00/lvol1
48432c88 225
c63b155d
ZK
226Converts a mirror logical volume to a RAID1 logical volume with the same
227number of images:
228.sp
229.B lvconvert \-\-type raid1 vg00/mirror_lv
c808baef 230
c63b155d
ZK
231Converts logical volume "vg00/lvol2" to snapshot of original volume
232"vg00/lvol1":
233.sp
234.B lvconvert \-s vg00/lvol1 vg00/lvol2
23087fc9 235
c63b155d
ZK
236Converts linear logical volume "vg00/lvol1" to a two-way mirror,
237using physical extents /dev/sda:0-15 and /dev/sdb:0-15 for allocation
238of new extents:
239.sp
240.B lvconvert \-m1 vg00/lvol1 /dev/sda:0-15 /dev/sdb:0-15
a39ac3e1 241
c63b155d
ZK
242Converts mirror logical volume "vg00/lvmirror1" to linear, freeing physical
243extents from /dev/sda:
244.sp
245.B lvconvert \-m0 vg00/lvmirror1 /dev/sda
246
247Merges "vg00/lvol1_snap" into its origin:
248.sp
249.B lvconvert \-\-merge vg00/lvol1_snap
250
251If "vg00/lvol1", "vg00/lvol2" and "vg00/lvol3" are all tagged with "some_tag"
252each snapshot logical volume will be merged serially,
253e.g.: "vg00/lvol1", then "vg00/lvol2", then "vg00/lvol3".
254If \-\-background were used it would start
234b1248 255all snapshot logical volume merges in parallel.
c63b155d
ZK
256.sp
257.B lvconvert \-\-merge @some_tag
234b1248 258
c63b155d 259Extracts one image from the mirror, making it a new logical volume named
a2facf4a
JEB
260"lv_split". The mirror the image is extracted from is reduced accordingly.
261If it was a 2-way mirror (created with '-m 1'), then the resulting original
262volume will be linear.
c63b155d
ZK
263.sp
264.B lvconvert \-\-splitmirrors 1 \-\-name lv_split vg00/lvmirror1
a2facf4a 265
c63b155d
ZK
266A mirrored logical volume created with \-\-type raid1 can use the
267\-\-trackchanges argument when splitting off an image.
d854bae8
AK
268Detach one image from the mirrored logical volume lv_raid1 as a separate
269read-only device and track the changes made to the mirror while it is detached.
270The split-off device has a name of the form lv_raid1_rimage_N, where N is
271a number, and it cannot be renamed.
c63b155d
ZK
272.sp
273.B lvconvert \-\-splitmirrors 1 \-\-trackchanges vg00/lv_raid1
a2facf4a 274
c63b155d
ZK
275Merge an image that was detached temporarily from its mirror with
276the \-\-trackchanges argument back into its original mirror and
d854bae8 277bring its contents back up-to-date.
c63b155d
ZK
278.sp
279.B lvconvert \-\-merge vg00/lv_raid1_rimage_1
a2facf4a 280
c63b155d 281Replaces the physical volume "/dev/sdb1" in the RAID1 logical volume "my_raid1"
0c506d9a
JEB
282with the specified physical volume "/dev/sdf1". Had the argument "/dev/sdf1"
283been left out, lvconvert would attempt to find a suitable device from those
284available in the volume group.
c63b155d
ZK
285.sp
286.B lvconvert \-\-replace /dev/sdb1 vg00/my_raid1 /dev/sdf1
0c506d9a 287
48432c88
AK
288.SH SEE ALSO
289.BR lvm (8),
290.BR vgcreate (8),
291.BR lvremove (8),
292.BR lvrename (8),
293.BR lvextend (8),
294.BR lvreduce (8),
295.BR lvdisplay (8),
296.BR lvscan (8)
This page took 0.088167 seconds and 5 git commands to generate.