]>
Commit | Line | Data |
---|---|---|
5951ef33 | 1 | .TH LVCONVERT 8 "LVM TOOLS #VERSION#" "Red Hat, Inc" \" -*- nroff -*- |
48432c88 | 2 | .SH NAME |
e0096cab | 3 | lvconvert \- 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 |
77 | lvconvert is used to change the segment type (i.e. linear, mirror, etc) or |
78 | characteristics of a logical volume. For example, it can add or remove the | |
79 | redundant images of a logical volume, change the log type of a mirror, or | |
80 | designate a logical volume as a snapshot repository. | |
23087fc9 DW |
81 | .br |
82 | If the conversion requires allocation of physical extents (for | |
83 | example, when converting from linear to mirror) and you specify | |
84 | one or more PhysicalVolumes (optionally with ranges of physical | |
85 | extents), allocation of physical extents will be restricted to | |
86 | these physical extents. If the conversion frees physical extents | |
87 | (for example, when converting from a mirror to a linear, or reducing | |
88 | mirror legs) and you specify one or more PhysicalVolumes, | |
89 | the freed extents come first from the specified PhysicalVolumes. | |
48432c88 | 90 | .SH OPTIONS |
c63b155d | 91 | See \fBlvm\fP(8) for common options. |
e0096cab | 92 | .br |
c63b155d ZK |
93 | Exactly one of |
94 | .BR \-\-splitmirrors ", " \-\-mirrors ", " \-\-repair ", " \-\-snapshot | |
95 | or \fB\-\-merge\fP arguments is required. | |
48432c88 | 96 | .TP |
c63b155d | 97 | .BR \-m ", " \-\-mirrors " " \fIMirrors |
48432c88 | 98 | Specifies the degree of the mirror you wish to create. |
c63b155d | 99 | For example, "\fB-m 1\fP" would convert the original logical |
48432c88 AK |
100 | volume to a mirror volume with 2-sides; that is, a |
101 | linear volume plus one copy. | |
102 | .TP | |
c63b155d | 103 | .IR \fB\-\-mirrorlog " {" disk | core | mirrored } |
230948b9 AK |
104 | Specifies the type of log to use. |
105 | The default is disk, which is persistent and requires | |
106 | a small amount of storage space, usually on a separate device | |
107 | from the data being mirrored. | |
108 | Core may be useful for short-lived mirrors: It means the mirror is | |
109 | regenerated by copying the data from the first device again every | |
110 | time the device is activated - perhaps, for example, after every reboot. | |
7a369d37 | 111 | Using "mirrored" will create a persistent log that is itself mirrored. |
a6d4f21c | 112 | .TP |
c63b155d ZK |
113 | .B \-\-corelog |
114 | The 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 |
118 | A mirror is divided into regions of this size (in MB), and the mirror log |
119 | uses this granularity to track which regions are in sync. | |
ba0c495d | 120 | .TP |
c63b155d | 121 | .B \-\-type \fISegmentType |
e4eaed81 | 122 | Used to convert a logical volume to another segment type or to explicitly state |
c63b155d ZK |
123 | the desired RAID1 segment type (\fImirror\fP or \fIraid1\fP) when converting |
124 | a linear logical volume to a mirror with the \fB-m\fP argument. | |
e4eaed81 | 125 | .TP |
c63b155d | 126 | .BR \-b ", " \-\-background |
ba0c495d AK |
127 | Run the daemon in the background. |
128 | .TP | |
c63b155d | 129 | .BR \-i ", " \-\-interval " " \fISeconds |
ba0c495d | 130 | Report progress as a percentage at regular intervals. |
e0096cab | 131 | .TP |
c63b155d | 132 | .B \-\-noudevsync |
c48b1005 PR |
133 | Disable udev synchronisation. The |
134 | process will not wait for notification from udev. | |
135 | It will continue irrespective of any possible udev processing | |
136 | in the background. You should only use this if udev is not running | |
137 | or has rules that ignore the devices LVM2 creates. | |
138 | .TP | |
c63b155d | 139 | .B \-\-splitmirrors \fIImages |
72e07436 JEB |
140 | The number of redundant Images of a mirror to be split off and used |
141 | to form a new logical volume. A name must be supplied for the | |
c63b155d ZK |
142 | newly-split-off logical volume using the \fB\-\-name\fP argument, unless |
143 | the \fB\-\-trackchanges\fP argument is given. | |
72e07436 | 144 | .TP |
c63b155d | 145 | .B \-n \fIName |
72e07436 JEB |
146 | The name to apply to a logical volume which has been split off from |
147 | a mirror logical volume. | |
6d04311e | 148 | .TP |
c63b155d ZK |
149 | .B \-\-trackchanges |
150 | Used with \fB\-\-splitmirrors\fP on a raid1 device, this tracks changes so | |
151 | that the read-only detached image can be merged efficiently back into | |
152 | the mirror later. Only the regions of the detatched device where | |
153 | the data changed get resynchronized. | |
d854bae8 AK |
154 | |
155 | Please note that this feature is only supported with the new md-based mirror | |
156 | implementation and not with the original device-mapper mirror implementation. | |
eb23252b | 157 | .TP |
c63b155d | 158 | .B \-s, \-\-snapshot |
e0096cab MB |
159 | Create a snapshot from existing logical volume using another |
160 | existing logical volume as its origin. | |
161 | .TP | |
c63b155d ZK |
162 | .BR \-c ", " \-\-chunksize " " \fIChunkSize |
163 | Power of 2 chunk size for the snapshot logical volume between 4KiB and 512KiB. | |
e0096cab | 164 | .TP |
c63b155d | 165 | .BR \-Z ", " \-\-zero " {" \fIy | \fIn } |
e0096cab | 166 | Controls zeroing of the first KB of data in the snapshot. |
fb12fd44 | 167 | If the volume is read-only the snapshot will not be zeroed. |
a39ac3e1 | 168 | .TP |
c63b155d | 169 | .B \-\-merge |
d854bae8 | 170 | Merges a snapshot into its origin volume or merges a raid1 image that has |
c63b155d | 171 | been split from its mirror with \fB\-\-trackchanges\fP back into its mirror. |
a2facf4a JEB |
172 | |
173 | To check if your kernel supports the snapshot merge feature, look | |
174 | for 'snapshot-merge' in the output | |
c63b155d | 175 | of \fBdmsetup targets\fP. If both the origin and snapshot volume are not |
9443b5d4 | 176 | open the merge will start immediately. Otherwise, the merge will start |
a39ac3e1 MS |
177 | the first time either the origin or snapshot are activated and both are closed. |
178 | Merging a snapshot into an origin that cannot be closed, for example a root | |
179 | filesystem, is deferred until the next time the origin volume is activated. | |
180 | When merging starts, the resulting logical volume will have the origin's name, | |
181 | minor number and UUID. While the merge is in progress, reads or writes to the | |
182 | origin appear as they were directed to the snapshot being merged. When the | |
234b1248 MS |
183 | merge finishes, the merged snapshot is removed. Multiple snapshots may |
184 | be specified on the commandline or a @tag may be used to specify | |
185 | multiple snapshots be merged to their respective origin. | |
72e07436 | 186 | .TP |
c63b155d | 187 | .B \-\-repair |
72e07436 JEB |
188 | Repair a mirror after suffering a disk failure. The mirror will be brought back |
189 | into a consistent state. By default, the original number of mirrors will be | |
c63b155d ZK |
190 | restored if possible. Specify \fB\-y\fP on the command line to skip |
191 | the prompts. Use \fB\-f\fP if you do not want any replacement. | |
192 | Additionally, you may use \fB\-\-use-policies\fP to use the device | |
193 | replacement policy specified in \fBlvm.conf\fP(5), | |
72e07436 JEB |
194 | viz. activation/mirror_log_fault_policy or |
195 | activation/mirror_device_fault_policy. | |
0c506d9a | 196 | .TP |
c63b155d ZK |
197 | .B \-\-replace \fIPhysicalVolume |
198 | Remove the specified device (\fIPhysicalVolume\fP) and replace it with one | |
199 | that is available in the volume group or from the specific list provided. | |
200 | This option is only available to RAID segment types | |
201 | (e.g. "raid1", "raid5", etc). | |
0c506d9a | 202 | |
48432c88 | 203 | .SH Examples |
c63b155d ZK |
204 | Converts the linear logical volume "vg00/lvol1" to a two-way mirror |
205 | logical volume: | |
206 | .sp | |
207 | .B lvconvert \-m1 vg00/lvol1 | |
48432c88 | 208 | |
c63b155d ZK |
209 | Converts the linear logical volume "vg00/lvol1" to a two-way RAID1 |
210 | logical volume: | |
211 | .sp | |
212 | .B lvconvert \-\-type raid1 \-m1 vg00/lvol1 | |
19583d11 | 213 | |
c63b155d ZK |
214 | Converts 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 |
218 | Converts 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 |
222 | Converts a mirror logical volume to a linear logical volume: |
223 | .sp | |
224 | .B lvconvert \-m0 vg00/lvol1 | |
48432c88 | 225 | |
c63b155d ZK |
226 | Converts a mirror logical volume to a RAID1 logical volume with the same |
227 | number of images: | |
228 | .sp | |
229 | .B lvconvert \-\-type raid1 vg00/mirror_lv | |
c808baef | 230 | |
c63b155d ZK |
231 | Converts 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 |
236 | Converts linear logical volume "vg00/lvol1" to a two-way mirror, |
237 | using physical extents /dev/sda:0-15 and /dev/sdb:0-15 for allocation | |
238 | of new extents: | |
239 | .sp | |
240 | .B lvconvert \-m1 vg00/lvol1 /dev/sda:0-15 /dev/sdb:0-15 | |
a39ac3e1 | 241 | |
c63b155d ZK |
242 | Converts mirror logical volume "vg00/lvmirror1" to linear, freeing physical |
243 | extents from /dev/sda: | |
244 | .sp | |
245 | .B lvconvert \-m0 vg00/lvmirror1 /dev/sda | |
246 | ||
247 | Merges "vg00/lvol1_snap" into its origin: | |
248 | .sp | |
249 | .B lvconvert \-\-merge vg00/lvol1_snap | |
250 | ||
251 | If "vg00/lvol1", "vg00/lvol2" and "vg00/lvol3" are all tagged with "some_tag" | |
252 | each snapshot logical volume will be merged serially, | |
253 | e.g.: "vg00/lvol1", then "vg00/lvol2", then "vg00/lvol3". | |
254 | If \-\-background were used it would start | |
234b1248 | 255 | all snapshot logical volume merges in parallel. |
c63b155d ZK |
256 | .sp |
257 | .B lvconvert \-\-merge @some_tag | |
234b1248 | 258 | |
c63b155d | 259 | Extracts 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. |
261 | If it was a 2-way mirror (created with '-m 1'), then the resulting original | |
262 | volume will be linear. | |
c63b155d ZK |
263 | .sp |
264 | .B lvconvert \-\-splitmirrors 1 \-\-name lv_split vg00/lvmirror1 | |
a2facf4a | 265 | |
c63b155d ZK |
266 | A mirrored logical volume created with \-\-type raid1 can use the |
267 | \-\-trackchanges argument when splitting off an image. | |
d854bae8 AK |
268 | Detach one image from the mirrored logical volume lv_raid1 as a separate |
269 | read-only device and track the changes made to the mirror while it is detached. | |
270 | The split-off device has a name of the form lv_raid1_rimage_N, where N is | |
271 | a number, and it cannot be renamed. | |
c63b155d ZK |
272 | .sp |
273 | .B lvconvert \-\-splitmirrors 1 \-\-trackchanges vg00/lv_raid1 | |
a2facf4a | 274 | |
c63b155d ZK |
275 | Merge an image that was detached temporarily from its mirror with |
276 | the \-\-trackchanges argument back into its original mirror and | |
d854bae8 | 277 | bring its contents back up-to-date. |
c63b155d ZK |
278 | .sp |
279 | .B lvconvert \-\-merge vg00/lv_raid1_rimage_1 | |
a2facf4a | 280 | |
c63b155d | 281 | Replaces the physical volume "/dev/sdb1" in the RAID1 logical volume "my_raid1" |
0c506d9a JEB |
282 | with the specified physical volume "/dev/sdf1". Had the argument "/dev/sdf1" |
283 | been left out, lvconvert would attempt to find a suitable device from those | |
284 | available 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) |