1LVM(8) System Manager's Manual LVM(8)
2
3
4
6 lvm - LVM2 tools
7
9 lvm [command | file]
10
12 lvm provides the command-line tools for LVM2. A separate manual page
13 describes each command in detail.
14
15 If lvm is invoked with no arguments it presents a readline prompt
16 (assuming it was compiled with readline support). LVM commands may be
17 entered interactively at this prompt with readline facilities including
18 history and command name and option completion. Refer to readline(3)
19 for details.
20
21 If lvm is invoked with argv[0] set to the name of a specific LVM com‐
22 mand (for example by using a hard or soft link) it acts as that com‐
23 mand.
24
25 On invocation, lvm requires that only the standard file descriptors
26 stdin, stdout and stderr are available. If others are found, they get
27 closed and messages are issued warning about the leak.
28
29 Where commands take VG or LV names as arguments, the full path name is
30 optional. An LV called "lvol0" in a VG called "vg0" can be specified
31 as "vg0/lvol0". Where a list of VGs is required but is left empty, a
32 list of all VGs will be substituted. Where a list of LVs is required
33 but a VG is given, a list of all the LVs in that VG will be substi‐
34 tuted. So "lvdisplay vg0" will display all the LVs in "vg0". Tags can
35 also be used - see addtag below.
36
37 One advantage of using the built-in shell is that configuration infor‐
38 mation gets cached internally between commands.
39
40 A file containing a simple script with one command per line can also be
41 given on the command line. The script can also be executed directly if
42 the first line is #! followed by the absolute path of lvm.
43
45 The following commands are built into lvm without links normally being
46 created in the filesystem for them.
47
48 dumpconfig — Display the configuration information after
49 loading lvm.conf (5) and any other configuration files.
50
51 formats — Display recognised metadata formats.
52
53 help — Display the help text.
54
55 pvdata — Not implemented in LVM2.
56
57 segtypes — Display recognised logical volume segment types.
58
59 version — Display version information.
60
62 The following commands implement the core LVM functionality.
63
64 pvchange — Change attributes of a physical volume.
65
66 pvck — Check physical volume metadata.
67
68 pvcreate — Initialize a disk or partition for use by LVM.
69
70 pvdisplay — Display attributes of a physical volume.
71
72 pvmove — Move physical extents.
73
74 pvremove — Remove a physical volume.
75
76 pvresize — Resize a disk or partition in use by LVM2.
77
78 pvs — Report information about physical volumes.
79
80 pvscan — Scan all disks for physical volumes.
81
82 vgcfgbackup — Backup volume group descriptor area.
83
84 vgcfgrestore — Restore volume group descriptor area.
85
86 vgchange — Change attributes of a volume group.
87
88 vgck — Check volume group metadata.
89
90 vgconvert — Convert volume group metadata format.
91
92 vgcreate — Create a volume group.
93
94 vgdisplay — Display attributes of volume groups.
95
96 vgexport — Make volume groups unknown to the system.
97
98 vgextend — Add physical volumes to a volume group.
99
100 vgimport — Make exported volume groups known to the system.
101
102 vgimportclone — Import and rename duplicated volume group (e.g. a hard‐
103 ware snapshot).
104
105 vgmerge — Merge two volume groups.
106
107 vgmknodes — Recreate volume group directory and logical volume special
108 files
109
110 vgreduce — Reduce a volume group by removing one or more physical vol‐
111 umes.
112
113 vgremove — Remove a volume group.
114
115 vgrename — Rename a volume group.
116
117 vgs — Report information about volume groups.
118
119 vgscan — Scan all disks for volume groups and rebuild caches.
120
121 vgsplit — Split a volume group into two, moving any logical volumes
122 from one volume group to another by moving entire physical volumes.
123
124 lvchange — Change attributes of a logical volume.
125
126 lvconvert — Convert a logical volume from linear to mirror or snapshot.
127
128 lvcreate — Create a logical volume in an existing volume group.
129
130 lvdisplay — Display attributes of a logical volume.
131
132 lvextend — Extend the size of a logical volume.
133
134 lvmchange — Change attributes of the logical volume manager.
135
136 lvmdiskscan — Scan for all devices visible to LVM2.
137
138 lvmdump — Create lvm2 information dumps for diagnostic purposes.
139
140 lvreduce — Reduce the size of a logical volume.
141
142 lvremove — Remove a logical volume.
143
144 lvrename — Rename a logical volume.
145
146 lvresize — Resize a logical volume.
147
148 lvs — Report information about logical volumes.
149
150 lvscan — Scan (all disks) for logical volumes.
151
152 The following commands are not implemented in LVM2 but might be in the
153 future: lvmsadc, lvmsar, pvdata.
154
156 The following options are available for many of the commands. They are
157 implemented generically and documented here rather than repeated on
158 individual manual pages.
159
160 -h | --help — Display the help text.
161
162 --version — Display version information.
163
164 -v | --verbose — Set verbose level.
165 Repeat from 1 to 3 times to increase the detail of messages sent
166 to stdout and stderr. Overrides config file setting.
167
168 -d | --debug — Set debug level.
169 Repeat from 1 to 6 times to increase the detail of messages sent
170 to the log file and/or syslog (if configured). Overrides config
171 file setting.
172
173 --quiet — Suppress output and log messages.
174 Overrides -d and -v.
175
176 -t | --test — Run in test mode.
177 Commands will not update metadata. This is implemented by dis‐
178 abling all metadata writing but nevertheless returning success
179 to the calling function. This may lead to unusual error mes‐
180 sages in multi-stage operations if a tool relies on reading back
181 metadata it believes has changed but hasn't.
182
183 --driverloaded { y | n }
184 Whether or not the device-mapper kernel driver is loaded. If
185 you set this to n, no attempt will be made to contact the
186 driver.
187
188 -A | --autobackup { y | n }
189 Whether or not to metadata should be backed up automatically
190 after a change. You are strongly advised not to disable this!
191 See vgcfgbackup (8).
192
193 -P | --partial
194 When set, the tools will do their best to provide access to vol‐
195 ume groups that are only partially available (one or more physi‐
196 cal volumes belonging to the volume group are missing from the
197 system). Where part of a logical volume is missing, /dev/ioer‐
198 ror will be substituted, and you could use dmsetup (8) to set
199 this up to return I/O errors when accessed, or create it as a
200 large block device of nulls. Metadata may not be changed with
201 this option. To insert a replacement physical volume of the same
202 or large size use pvcreate -u to set the uuid to match the orig‐
203 inal followed by vgcfgrestore (8).
204
205 -M | --metadatatype type
206 Specifies which type of on-disk metadata to use, such as lvm1 or
207 lvm2, which can be abbreviated to 1 or 2 respectively. The
208 default (lvm2) can be changed by setting format in the global
209 section of the config file.
210
211 --ignorelockingfailure
212 This lets you proceed with read-only metadata operations such as
213 lvchange -ay and vgchange -ay even if the locking module fails.
214 One use for this is in a system init script if the lock direc‐
215 tory is mounted read-only when the script runs.
216
217 --addtag tag
218 Add the tag tag to a PV, VG or LV. Supply this argument multi‐
219 ple times to add more than one tag at once. A tag is a word
220 that can be used to group LVM2 objects of the same type
221 together. Tags can be given on the command line in place of PV,
222 VG or LV arguments. Tags should be prefixed with @ to avoid
223 ambiguity. Each tag is expanded by replacing it with all
224 objects possessing that tag which are of the type expected by
225 its position on the command line. PVs can only possess tags
226 while they are part of a Volume Group: PV tags are discarded if
227 the PV is removed from the VG. As an example, you could tag
228 some LVs as database and others as userdata and then activate
229 the database ones with lvchange -ay @database. Objects can pos‐
230 sess multiple tags simultaneously. Only the new LVM2 metadata
231 format supports tagging: objects using the LVM1 metadata format
232 cannot be tagged because the on-disk format does not support it.
233 Snapshots cannot be tagged. Characters allowed in tags are: A-Z
234 a-z 0-9 _ + . - and as of version 2.02.78 the following charac‐
235 ters are also accepted: / = ! : # &
236
237 --deltag tag
238 Delete the tag tag from a PV, VG or LV, if it's present. Supply
239 this argument multiple times to remove more than one tag at
240 once.
241
242 --alloc AllocationPolicy
243 The allocation policy to use: contiguous, cling, normal, any‐
244 where or inherit. When a command needs to allocate physical
245 extents from the volume group, the allocation policy controls
246 how they are chosen. Each volume group and logical volume has
247 an allocation policy. The default for a volume group is normal
248 which applies common-sense rules such as not placing parallel
249 stripes on the same physical volume. The default for a logical
250 volume is inherit which applies the same policy as for the vol‐
251 ume group. These policies can be changed using lvchange (8) and
252 vgchange [22m(8) or over-ridden on the command line of any command
253 that performs allocation. The contiguous policy requires that
254 new extents be placed adjacent to existing extents. The cling
255 policy places new extents on the same physical volume as exist‐
256 ing extents in the same stripe of the Logical Volume. If there
257 are sufficient free extents to satisfy an allocation request but
258 normal doesn't use them, anywhere will - even if that reduces
259 performance by placing two stripes on the same physical volume.
260
261 N.B. The policies described above are not implemented fully yet.
262 In particular, contiguous free space cannot be broken up to sat‐
263 isfy allocation attempts.
264
266 LVM_SYSTEM_DIR
267 Directory containing lvm.conf and other LVM system files.
268 Defaults to "/etc/lvm".
269
270 HOME Directory containing .lvm_history if the internal readline shell
271 is invoked.
272
273 LVM_VG_NAME
274 The volume group name that is assumed for any reference to a
275 logical volume that doesn't specify a path. Not set by default.
276
278 The following characters are valid for VG and LV names: a-z A-Z 0-9 + _
279 . -
280
281 VG and LV names cannot begin with a hyphen. There are also various
282 reserved names that are used internally by lvm that can not be used as
283 LV or VG names. A VG cannot be called anything that exists in /dev/ at
284 the time of creation, nor can it be called '.' or '..'. A LV cannot be
285 called '.' '..' 'snapshot' or 'pvmove'. The LV name may also not con‐
286 tain the strings '_mlog' or '_mimage'
287
288
289
291 All tools return a status code of zero on success or non-zero on fail‐
292 ure.
293
295 /etc/lvm/lvm.conf
296 $HOME/.lvm_history
297
299 clvmd(8), lvchange(8), lvcreate(8), lvdisplay(8), lvextend(8), lvm‐
300 change(8), lvmdiskscan(8), lvreduce(8), lvremove(8), lvrename(8), lvre‐
301 size(8), lvs(8), lvscan(8), pvchange(8), pvck(8), pvcreate(8), pvdis‐
302 play(8), pvmove(8), pvremove(8), pvs(8), pvscan(8), vgcfgbackup(8),
303 vgchange(8), vgck(8), vgconvert(8), vgcreate(8), vgdisplay(8), vgex‐
304 tend(8), vgimport(8), vgimportclone(8), vgmerge(8), vgmknodes(8), vgre‐
305 duce(8), vgremove(8), vgrename(8), vgs(8), vgscan(8), vgsplit(8), read‐
306 line(3), lvm.conf(5)
307
308
309
310
311Sistina Software UK LVM TOOLS 2.02.84(2) (2011-02-09) LVM(8)