]>
Commit | Line | Data |
---|---|---|
5951ef33 | 1 | .TH LVM 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*- |
ef91884b AK |
2 | .SH NAME |
3 | lvm \- LVM2 tools | |
4 | .SH SYNOPSIS | |
5 | .B lvm | |
136e98d2 | 6 | [command | file] |
ef91884b | 7 | .SH DESCRIPTION |
136e98d2 AK |
8 | \fBlvm\fP provides the command-line tools for LVM2. A separate |
9 | manual page describes each command in detail. | |
10 | .LP | |
11 | If \fBlvm\fP is invoked with no arguments it presents a readline prompt | |
12 | (assuming it was compiled with readline support). | |
13 | LVM commands may be entered interactively at this prompt with | |
14 | readline facilities including history and command name and option | |
15 | completion. Refer to \fBreadline\fP(3) for details. | |
16 | .LP | |
17 | If \fBlvm\fP is invoked with argv[0] set to the name of a specific | |
18 | LVM command (for example by using a hard or soft link) it acts as | |
19 | that command. | |
20 | .LP | |
45bec967 AK |
21 | On invocation, \fBlvm\fP requires that only the standard file descriptors |
22 | stdin, stdout and stderr are available. If others are found, they | |
23 | get closed and messages are issued warning about the leak. | |
24 | .LP | |
d6cf4325 AK |
25 | Where commands take VG or LV names as arguments, the full path name is |
26 | optional. An LV called "lvol0" in a VG called "vg0" can be specified | |
27 | as "vg0/lvol0". Where a list of VGs is required but is left empty, | |
28 | a list of all VGs will be substituted. Where a list of LVs is required | |
29 | but a VG is given, a list of all the LVs in that VG will be substituted. | |
30 | So "lvdisplay vg0" will display all the LVs in "vg0". | |
31 | Tags can also be used - see \fBaddtag\fP below. | |
32 | .LP | |
136e98d2 | 33 | One advantage of using the built-in shell is that configuration |
d6cf4325 | 34 | information gets cached internally between commands. |
136e98d2 AK |
35 | .LP |
36 | A file containing a simple script with one command per line | |
37 | can also be given on the command line. The script can also be | |
38 | executed directly if the first line is #! followed by the absolute | |
39 | path of \fBlvm\fP. | |
d6cf4325 AK |
40 | .SH BUILT-IN COMMANDS |
41 | The following commands are built into lvm without links normally | |
42 | being created in the filesystem for them. | |
43 | .TP | |
44 | \fBdumpconfig\fP \(em Display the configuration information after | |
4af059bd | 45 | loading \fBlvm.conf\fP (5) and any other configuration files. |
d6cf4325 AK |
46 | .TP |
47 | \fBformats\fP \(em Display recognised metadata formats. | |
48 | .TP | |
49 | \fBhelp\fP \(em Display the help text. | |
50 | .TP | |
51 | \fBpvdata\fP \(em Not implemented in LVM2. | |
52 | .TP | |
53 | \fBsegtypes\fP \(em Display recognised logical volume segment types. | |
54 | .TP | |
55 | \fBversion\fP \(em Display version information. | |
5a52dca9 | 56 | .LP |
dc5f6f1b DW |
57 | .SH COMMANDS |
58 | The following commands implement the core LVM functionality. | |
59 | .TP | |
60 | \fBpvchange\fP \(em Change attributes of a physical volume. | |
61 | .TP | |
62 | \fBpvck\fP \(em Check physical volume metadata. | |
63 | .TP | |
64 | \fBpvcreate\fP \(em Initialize a disk or partition for use by LVM. | |
65 | .TP | |
66 | \fBpvdisplay\fP \(em Display attributes of a physical volume. | |
67 | .TP | |
68 | \fBpvmove\fP \(em Move physical extents. | |
69 | .TP | |
70 | \fBpvremove\fP \(em Remove a physical volume. | |
71 | .TP | |
72 | \fBpvresize\fP \(em Resize a disk or partition in use by LVM2. | |
73 | .TP | |
dc5f6f1b DW |
74 | \fBpvs\fP \(em Report information about physical volumes. |
75 | .TP | |
76 | \fBpvscan\fP \(em Scan all disks for physical volumes. | |
77 | .TP | |
78 | \fBvgcfgbackup\fP \(em Backup volume group descriptor area. | |
79 | .TP | |
80 | \fBvgcfgrestore\fP \(em Restore volume group descriptor area. | |
81 | .TP | |
82 | \fBvgchange\fP \(em Change attributes of a volume group. | |
83 | .TP | |
84 | \fBvgck\fP \(em Check volume group metadata. | |
85 | .TP | |
86 | \fBvgconvert\fP \(em Convert volume group metadata format. | |
87 | .TP | |
88 | \fBvgcreate\fP \(em Create a volume group. | |
89 | .TP | |
90 | \fBvgdisplay\fP \(em Display attributes of volume groups. | |
91 | .TP | |
92 | \fBvgexport\fP \(em Make volume groups unknown to the system. | |
93 | .TP | |
94 | \fBvgextend\fP \(em Add physical volumes to a volume group. | |
95 | .TP | |
96 | \fBvgimport\fP \(em Make exported volume groups known to the system. | |
97 | .TP | |
761e5741 MS |
98 | \fBvgimportclone\fP \(em Import and rename duplicated volume group (e.g. a hardware snapshot). |
99 | .TP | |
dc5f6f1b DW |
100 | \fBvgmerge\fP \(em Merge two volume groups. |
101 | .TP | |
102 | \fBvgmknodes\fP \(em Recreate volume group directory and logical volume special files | |
103 | .TP | |
104 | \fBvgreduce\fP \(em Reduce a volume group by removing one or more physical volumes. | |
105 | .TP | |
106 | \fBvgremove\fP \(em Remove a volume group. | |
107 | .TP | |
108 | \fBvgrename\fP \(em Rename a volume group. | |
109 | .TP | |
110 | \fBvgs\fP \(em Report information about volume groups. | |
111 | .TP | |
112 | \fBvgscan\fP \(em Scan all disks for volume groups and rebuild caches. | |
113 | .TP | |
114 | \fBvgsplit\fP \(em Split a volume group into two, moving any logical volumes from one volume group to another by moving entire physical volumes. | |
115 | .TP | |
116 | \fBlvchange\fP \(em Change attributes of a logical volume. | |
117 | .TP | |
118 | \fBlvconvert\fP \(em Convert a logical volume from linear to mirror or snapshot. | |
119 | .TP | |
120 | \fBlvcreate\fP \(em Create a logical volume in an existing volume group. | |
121 | .TP | |
122 | \fBlvdisplay\fP \(em Display attributes of a logical volume. | |
123 | .TP | |
124 | \fBlvextend\fP \(em Extend the size of a logical volume. | |
125 | .TP | |
126 | \fBlvmchange\fP \(em Change attributes of the logical volume manager. | |
127 | .TP | |
128 | \fBlvmdiskscan\fP \(em Scan for all devices visible to LVM2. | |
129 | .TP | |
130 | \fBlvmdump\fP \(em Create lvm2 information dumps for diagnostic purposes. | |
131 | .TP | |
132 | \fBlvreduce\fP \(em Reduce the size of a logical volume. | |
133 | .TP | |
134 | \fBlvremove\fP \(em Remove a logical volume. | |
135 | .TP | |
136 | \fBlvrename\fP \(em Rename a logical volume. | |
137 | .TP | |
138 | \fBlvresize\fP \(em Resize a logical volume. | |
139 | .TP | |
140 | \fBlvs\fP \(em Report information about logical volumes. | |
141 | .TP | |
142 | \fBlvscan\fP \(em Scan (all disks) for logical volumes. | |
143 | .TP | |
746a2cdb | 144 | The following commands are not implemented in LVM2 but might be in the future: lvmsadc, lvmsar, pvdata. |
922ce479 | 145 | .SH OPTIONS |
d6cf4325 AK |
146 | The following options are available for many of the commands. |
147 | They are implemented generically and documented here rather | |
148 | than repeated on individual manual pages. | |
922ce479 AK |
149 | .TP |
150 | \fB-h | --help\fP \(em Display the help text. | |
151 | .TP | |
5a52dca9 | 152 | \fB--version\fP \(em Display version information. |
922ce479 AK |
153 | .TP |
154 | \fB-v | --verbose\fP \(em Set verbose level. | |
5a52dca9 | 155 | Repeat from 1 to 3 times to increase the detail of messages |
922ce479 AK |
156 | sent to stdout and stderr. Overrides config file setting. |
157 | .TP | |
158 | \fB-d | --debug\fP \(em Set debug level. | |
5a52dca9 | 159 | Repeat from 1 to 6 times to increase the detail of messages sent |
922ce479 AK |
160 | to the log file and/or syslog (if configured). |
161 | Overrides config file setting. | |
162 | .TP | |
163 | \fB--quiet\fP \(em Suppress output and log messages. | |
164 | Overrides -d and -v. | |
5a52dca9 AK |
165 | .TP |
166 | \fB-t | --test\fP \(em Run in test mode. | |
167 | Commands will not update metadata. | |
d6cf4325 AK |
168 | This is implemented by disabling all metadata writing but nevertheless |
169 | returning success to the calling function. This may lead to unusual | |
170 | error messages in multi-stage operations if a tool relies on reading | |
171 | back metadata it believes has changed but hasn't. | |
5a52dca9 AK |
172 | .TP |
173 | \fB--driverloaded\fP { \fBy\fP | \fBn\fP } | |
174 | Whether or not the device-mapper kernel driver is loaded. | |
175 | If you set this to \fBn\fP, no attempt will be made to contact the driver. | |
176 | .TP | |
177 | \fB-A | --autobackup\fP { \fBy\fP | \fBn\fP } | |
178 | Whether or not to metadata should be backed up automatically after a change. | |
179 | You are strongly advised not to disable this! | |
180 | See | |
181 | .B vgcfgbackup (8). | |
182 | .TP | |
183 | \fB-P | --partial\fP | |
184 | When set, the tools will do their best to provide access to volume groups | |
a0b0df93 DW |
185 | that are only partially available (one or more physical volumes belonging |
186 | to the volume group are missing from the system). Where part of a logical | |
187 | volume is missing, \fB/dev/ioerror\fP will be substituted, and you could use | |
5a52dca9 AK |
188 | \fBdmsetup (8)\fP to set this up to return I/O errors when accessed, |
189 | or create it as a large block device of nulls. Metadata may not be | |
190 | changed with this option. To insert a replacement physical volume | |
191 | of the same or large size use \fBpvcreate -u\fP to set the uuid to | |
192 | match the original followed by \fBvgcfgrestore (8)\fP. | |
193 | .TP | |
12da72ad AK |
194 | \fB-M | --metadatatype type\fP |
195 | Specifies which type of on-disk metadata to use, such as \fBlvm1\fP | |
196 | or \fBlvm2\fP, which can be abbreviated to \fB1\fP or \fB2\fP respectively. | |
197 | The default (lvm2) can be changed by setting \fBformat\fP in the \fBglobal\fP | |
198 | section of the config file. | |
199 | .TP | |
5a52dca9 AK |
200 | \fB--ignorelockingfailure\fP |
201 | This lets you proceed with read-only metadata operations such as | |
202 | \fBlvchange -ay\fP and \fBvgchange -ay\fP even if the locking module fails. | |
203 | One use for this is in a system init script if the lock directory | |
204 | is mounted read-only when the script runs. | |
12da72ad AK |
205 | .TP |
206 | \fB--addtag tag\fP | |
207 | Add the tag \fBtag\fP to a PV, VG or LV. | |
10955b82 | 208 | Supply this argument multiple times to add more than one tag at once. |
12da72ad AK |
209 | A tag is a word that can be used to group LVM2 objects of the same type |
210 | together. | |
211 | Tags can be given on the command line in place of PV, VG or LV | |
212 | arguments. Tags should be prefixed with @ to avoid ambiguity. | |
213 | Each tag is expanded by replacing it with all objects possessing | |
214 | that tag which are of the type expected by its position on the command line. | |
215 | PVs can only possess tags while they are part of a Volume Group: | |
216 | PV tags are discarded if the PV is removed from the VG. | |
217 | As an example, you could tag some LVs as \fBdatabase\fP and others | |
218 | as \fBuserdata\fP and then activate the database ones | |
219 | with \fBlvchange -ay @database\fP. | |
220 | Objects can possess multiple tags simultaneously. | |
221 | Only the new LVM2 metadata format supports tagging: objects using the | |
222 | LVM1 metadata format cannot be tagged because the on-disk format does not | |
223 | support it. | |
224 | Snapshots cannot be tagged. | |
10955b82 AK |
225 | Characters allowed in tags are: A-Z a-z 0-9 _ + . - and |
226 | as of version 2.02.78 the following characters are also | |
227 | accepted: / = ! : # & | |
12da72ad AK |
228 | .TP |
229 | \fB--deltag tag\fP | |
230 | Delete the tag \fBtag\fP from a PV, VG or LV, if it's present. | |
10955b82 | 231 | Supply this argument multiple times to remove more than one tag at once. |
63bea03e AK |
232 | .TP |
233 | \fB--alloc AllocationPolicy\fP | |
de5c82a0 | 234 | The allocation policy to use: \fBcontiguous\fP, \fBcling\fP, \fBnormal\fP, \fBanywhere\fP or \fBinherit\fP. |
63bea03e AK |
235 | When a command needs to allocate physical extents from the volume group, |
236 | the allocation policy controls how they are chosen. | |
237 | Each volume group and logical volume has an allocation policy. | |
238 | The default for a volume group is \fBnormal\fP which applies | |
239 | common-sense rules such as not placing parallel stripes on the same | |
240 | physical volume. The default for a logical volume is \fBinherit\fP | |
241 | which applies the same policy as for the volume group. These policies can | |
242 | be changed using \fBlvchange\fP (8) and \fBvgchange\fP (8) or over-ridden | |
243 | on the command line of any command that performs allocation. | |
de5c82a0 AK |
244 | The \fBcontiguous\fP policy requires that new extents be placed adjacent |
245 | to existing extents. | |
246 | The \fBcling\fP policy places new extents on the same physical | |
247 | volume as existing extents in the same stripe of the Logical Volume. | |
248 | If there are sufficient free extents to satisfy | |
63bea03e AK |
249 | an allocation request but \fBnormal\fP doesn't use them, |
250 | \fBanywhere\fP will - even if that reduces performance by | |
251 | placing two stripes on the same physical volume. | |
252 | .IP | |
253 | N.B. The policies described above are not implemented fully yet. | |
de5c82a0 AK |
254 | In particular, contiguous free space cannot be broken up to |
255 | satisfy allocation attempts. | |
136e98d2 AK |
256 | .SH ENVIRONMENT VARIABLES |
257 | .TP | |
258 | \fBLVM_SYSTEM_DIR\fP | |
259 | Directory containing lvm.conf and other LVM | |
260 | system files. | |
3399ae32 | 261 | Defaults to "#DEFAULT_SYS_DIR#". |
136e98d2 AK |
262 | .TP |
263 | \fBHOME\fP | |
5a52dca9 | 264 | Directory containing .lvm_history if the internal readline shell |
136e98d2 AK |
265 | is invoked. |
266 | .TP | |
136e98d2 AK |
267 | \fBLVM_VG_NAME\fP |
268 | The volume group name that is assumed for | |
269 | any reference to a logical volume that doesn't specify a path. | |
270 | Not set by default. | |
ec977d4c DW |
271 | .SH VALID NAMES |
272 | The following characters are valid for VG and LV names: | |
273 | \fBa-z A-Z 0-9 + _ . -\fP | |
274 | .LP | |
275 | VG and LV names cannot begin with a hyphen. | |
276 | There are also various reserved names that are used internally by lvm that can not be used as LV or VG names. | |
277 | A VG cannot be called anything that exists in /dev/ at the time of creation, nor can it be called '.' or '..'. | |
d495dd40 | 278 | A LV cannot be called '.' '..' 'snapshot' or 'pvmove'. The LV name may also not contain |
c219934a | 279 | the strings '_mlog', '_mimage', '_rimage', '_tdata', '_tmeta'. |
ec977d4c DW |
280 | |
281 | ||
922ce479 AK |
282 | .SH DIAGNOSTICS |
283 | All tools return a status code of zero on success or non-zero on failure. | |
ef91884b | 284 | .SH FILES |
3399ae32 | 285 | .I #DEFAULT_SYS_DIR#/lvm.conf |
ef91884b AK |
286 | .br |
287 | .I $HOME/.lvm_history | |
ef91884b | 288 | .SH SEE ALSO |
d6cf4325 | 289 | .BR clvmd (8), |
922ce479 AK |
290 | .BR lvchange (8), |
291 | .BR lvcreate (8), | |
292 | .BR lvdisplay (8), | |
293 | .BR lvextend (8), | |
294 | .BR lvmchange (8), | |
d6cf4325 | 295 | .BR lvmdiskscan (8), |
922ce479 AK |
296 | .BR lvreduce (8), |
297 | .BR lvremove (8), | |
298 | .BR lvrename (8), | |
299 | .BR lvresize (8), | |
d6cf4325 | 300 | .BR lvs (8), |
922ce479 AK |
301 | .BR lvscan (8), |
302 | .BR pvchange (8), | |
cc5a4e1d | 303 | .BR pvck (8), |
922ce479 AK |
304 | .BR pvcreate (8), |
305 | .BR pvdisplay (8), | |
d6cf4325 AK |
306 | .BR pvmove (8), |
307 | .BR pvremove (8), | |
308 | .BR pvs (8), | |
922ce479 AK |
309 | .BR pvscan (8), |
310 | .BR vgcfgbackup (8), | |
311 | .BR vgchange (8), | |
312 | .BR vgck (8), | |
d6cf4325 | 313 | .BR vgconvert (8), |
922ce479 AK |
314 | .BR vgcreate (8), |
315 | .BR vgdisplay (8), | |
316 | .BR vgextend (8), | |
d6cf4325 | 317 | .BR vgimport (8), |
761e5741 | 318 | .BR vgimportclone (8), |
922ce479 | 319 | .BR vgmerge (8), |
d6cf4325 | 320 | .BR vgmknodes (8), |
922ce479 AK |
321 | .BR vgreduce (8), |
322 | .BR vgremove (8), | |
323 | .BR vgrename (8), | |
d6cf4325 | 324 | .BR vgs (8), |
922ce479 | 325 | .BR vgscan (8), |
d6cf4325 | 326 | .BR vgsplit (8), |
136e98d2 AK |
327 | .BR readline (3), |
328 | .BR lvm.conf (5) | |
329 |