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