~ubuntu-branches/debian/stretch/lvm2/stretch

« back to all changes in this revision

Viewing changes to man/lvm.8.in

  • Committer: Package Import Robot
  • Author(s): Bastian Blank
  • Date: 2014-08-19 15:37:06 UTC
  • mfrom: (30.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20140819153706-0p2sc6a53ef7xnvl
Tags: 2.02.109-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
.TH LVM 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
2
2
.SH NAME
3
 
lvm \- LVM2 tools
 
3
lvm \(em LVM2 tools
4
4
.SH SYNOPSIS
5
5
.B lvm
6
6
[command | file]
174
174
.BR \-q ", "  \-\-quiet
175
175
Suppress output and log messages.
176
176
Overrides \fB\-d\fP and \fB\-v\fP.
 
177
Repeat once to also suppress any prompts with answer 'no'.
177
178
.TP
178
179
.BR \-\-yes
179
180
Don't prompt for confirmation interactively but instead always assume the
206
207
of the same or large size use \fBpvcreate \-u\fP to set the uuid to
207
208
match the original followed by \fBvgcfgrestore\fP(8).
208
209
.TP
 
210
.BR \-S ", " \-\-select " " \fISelection
 
211
For reporting commands, display only rows that match selection criteria.
 
212
All rows are displayed with the additional "selected" column (\fB-o selected\fP)
 
213
showing 1 if the row matches the Selection and 0 otherwise.
 
214
See \fBSELECTION CRITERIA\fP section of this man page for more
 
215
information about the way the selection criteria are constructed.
 
216
.TP
209
217
.BR \-M ", " \-\-metadatatype " " \fIType
210
218
Specifies which type of on-disk metadata to use, such as \fIlvm1\fP
211
219
or \fIlvm2\fP, which can be abbreviated to \fI1\fP or \fI2\fP respectively.
223
231
without clustered locking and some clustered Volume Groups have to be
224
232
skipped over.
225
233
.TP
 
234
.B \-\-readonly
 
235
Run the command in a special read-only mode which will read on-disk
 
236
metadata without needing to take any locks.  This can be used to peek
 
237
inside metadata used by a virtual machine image while the virtual
 
238
machine is running.
 
239
It can also be used to peek inside the metadata of clustered Volume
 
240
Groups when clustered locking is not configured or running.  No attempt
 
241
will be made to communicate with the device-mapper kernel driver, so
 
242
this option is unable to report whether or not Logical Volumes are 
 
243
actually in use.
 
244
.TP
226
245
.B \-\-addtag \fITag
227
246
Add the tag \fITag\fP to a PV, VG or LV.
228
247
Supply this argument multiple times to add more than one tag at once.
269
288
\fIanywhere\fP will - even if that reduces performance by
270
289
placing two stripes on the same Physical Volume.
271
290
.TP
272
 
.IR \fB\-\-profile \ ProfileName
273
 
Selects the configuration profile to use when processing an LVM command.
274
 
In addition to that, when creating a Volume Group or a Logical Volume,
275
 
it causes the ProfileName to be stored in metadata for each Volume Group
276
 
or Logical Volume. If the profile is stored in metadata, it is automatically
277
 
applied next time the Volume Group or the Logical Volume is processed and the
278
 
use of --profile is not necessary when running LVM commands further. See also
279
 
\fBlvm.conf\fP(5) for more information about \fBprofile config\fP and the
 
291
.IR \fB\-\-commandprofile " " \fIProfileName
 
292
Selects the command configuration profile to use when processing an LVM command.
 
293
See also \fBlvm.conf\fP(5) for more information about \fBcommand profile config\fP and
 
294
the way it fits with other LVM configuration methods.
 
295
.TP
 
296
.IR \fB\-\-metadataprofile " " \fIProfileName
 
297
Selects the metadata configuration profile to use when processing an LVM command.
 
298
When using metadata profile during Volume Group or Logical Volume creation,
 
299
the metadata profile name is saved in metadata. When such Volume Group or Logical
 
300
Volume is processed next time, the metadata profile is automatically applied
 
301
and the use of \-\-metadataprofile option is not necessary. See also
 
302
\fBlvm.conf\fP(5) for more information about \fBmetadata profile config\fP and the
280
303
way it fits with other LVM configuration methods.
281
304
.TP
 
305
.IR \fB\-\-profile " " \fIProfileName
 
306
A short form of \fB\-\-metadataprofile\fP for \fBvgcreate\fP, \fBlvcreate\fP,
 
307
\fBvgchange\fP and \fBlvchange\fP command and a short form of \fB\-\-commandprofile\fP
 
308
for any other command (with the exception of \fBdumpconfig\fP command where the
 
309
\-\-profile has special meaning, see \fBlvm dumpconfig\fP(8) for more information).
 
310
.TP
282
311
.IR \fB\-\-config \ ConfigurationString
283
312
Uses the ConfigurationString as direct string representation of the configuration
284
313
to override the existing configuration. The ConfigurationString is of exactly
318
347
A VG cannot be called anything that exists in /dev/ at the time of creation, nor can it be called '.' or '..'.
319
348
A LV cannot be called '.' '..' 'snapshot' or 'pvmove'. The LV name may also not contain
320
349
the strings '_mlog', '_mimage', '_rimage', '_tdata', '_tmeta'.
 
350
A directory bearing the name of each Volume Group is created under /dev when any of its Logical Volumes are activated.
 
351
Each active Logical Volume is accessible from this directory as a symbolic link leading to a device node.
 
352
Links or nodes in /dev/mapper are intended only for internal use and the precise format and escaping might change between releases and distributions.
 
353
Other software and scripts should use the
 
354
/dev/VolumeGroupName/LogicalVolumeName format to reduce the chance of needing
 
355
amendment when the software is updated.  Should you need to process the node
 
356
names in /dev/mapper, you may use \fBdmsetup splitname\fP to separate out the
 
357
original VG, LV and internal layer names.
321
358
.SH ALLOCATION
322
359
When an operation needs to allocate Physical Extents for one or more
323
360
Logical Volumes, the tools proceed as follows:
394
431
Some logical volume types are simple to create and can be done with a
395
432
single \fBlvcreate\fP(8) command.  The linear and striped logical
396
433
volume types are an example of this.  Other logical volume types may
397
 
require more than one command to create.  The cache and thin provisioning
398
 
types are examples of this.
399
 
 
400
 
.br
401
 
.SS Cache
402
 
The \fIcache\fP logical volume type uses a small and fast LV to improve
403
 
the performance of a large and slow LV.  It does this by storing the
404
 
frequently used blocks on the faster LV.
405
 
LVM refers to the small fast LV as a \fBcache pool LV\fP.  The large
406
 
slow LV is called the \fBorigin LV\fP.  Due to requirements from dm-cache
407
 
(the kernel driver), LVM further splits the cache pool LV into two
408
 
devices - the \fBcache data LV\fP and \fBcache metadata LV\fP.  The cache
409
 
data LV is where copies of data blocks are kept from the
410
 
origin LV to increase speed.  The cache metadata LV holds the
411
 
accounting information that specifies where data blocks are stored (e.g.
412
 
on the origin LV or on the cache data LV).  Users should be familiar with
413
 
these LVs if they wish to create the best and most robust cached
414
 
logical volumes.
415
 
 
416
 
.SS Cache Terms
417
 
.nf
418
 
origin LV           OriginLV      large slow LV
419
 
cache data LV       CacheDataLV   small fast LV for cache pool data
420
 
cache metadata LV   CacheMetaLV   small fast LV for cache pool metadata
421
 
cache pool LV       CachePoolLV   CacheDataLV + CacheMetaLV
422
 
cache LV            CacheLV       OriginLV + CachePoolLV
423
 
.fi
424
 
 
425
 
.SS Cache Steps
426
 
The steps to create a logical volume of \fIcache\fP type are as follows:
427
 
.TP
428
 
0.
429
 
Create an LV or identify an existing LV to be the origin LV.
430
 
.TP
431
 
1.
432
 
Create the cache data LV.  The size of this LV is the size of the cache
433
 
and will be reported as the size of the cache pool LV.
434
 
.TP
435
 
2.
436
 
Create the cache metadata LV.
437
 
The size of this LV should be 1000 times smaller than the cache data LV
438
 
with a minimum size of 8MiB.
439
 
.TP
440
 
3.
441
 
Create the cache pool LV by combining the cache data LV (from step 1)
442
 
and cache metadata LV (from step 2).  When performing this step,
443
 
behavioral characteristics of the cache pool LV can be set.
444
 
The name of the cache pool LV takes the name of the cache data LV and
445
 
the cache data LV and cache metadata LV are renamed
446
 
to CachePoolLV_cdata and CachePoolLV_cmeta.
447
 
.TP
448
 
4.
449
 
Create a cache LV by linking the cache pool LV to the origin LV.
450
 
The user accessible cache LV takes the name of the origin LV,
451
 
while the origin LV becomes a hidden LV with the name
452
 
OriginLV_corig.  Users can perform this step while the origin LV
453
 
is in use.
454
 
 
455
 
.P
456
 
The steps above represent the best way to create a cache LV.
457
 
They provide the most options and have the ability to create the
458
 
most robust logical volumes.  The examples below illustrate how these
459
 
steps might be used in practice.
460
 
 
461
 
.SS Cache Commands
462
 
.nf
463
 
0. create OriginLV
464
 
lvcreate -L LargeSize -n OriginLV VG SlowPVs
465
 
 
466
 
1. create CacheDataLV
467
 
lvcreate -L CacheSize -n CacheDataLV VG FastPVs
468
 
 
469
 
2. create CacheMetaLV
470
 
lvcreate -L MetaSize -n CacheMetaLV VG FastPVs
471
 
 
472
 
3. create CachePoolLV
473
 
lvconvert --type cache-pool --poolmetadata VG/CacheMetaLV VG/CacheDataLV
474
 
CachePoolLV takes the name of CacheDataLV.
475
 
CacheDataLV is renamed CachePoolLV_cdata and becomes hidden.
476
 
CacheMetaLV is renamed CachePoolLV_cmeta and becomes hidden.
477
 
 
478
 
4. create CacheLV
479
 
lvconvert --type cache --cachepool VG/CachePoolLV VG/OriginLV
480
 
CacheLV takes the name of OriginLV.
481
 
OriginLV is renamed OriginLV_corig and becomes hidden.
482
 
.fi
483
 
 
484
 
.SS Cache Examples
485
 
 
486
 
.B Example 1:
487
 
Creating a simple cache LV.
488
 
.br
489
 
 
490
 
.nf
491
 
0. Create the origin LV
492
 
# lvcreate -L 10G -n lvx vg /dev/slow_dev
493
 
 
494
 
1. Create a cache data LV
495
 
# lvcreate -L 1G -n lvx_cache vg /dev/fast_dev
496
 
 
497
 
2. Create a cache metadata LV (~1/1000th size of CacheDataLV or 8MiB)
498
 
# lvcreate -L 8M -n lvx_cache_meta vg /dev/fast_dev
499
 
 
500
 
3. Create a cache pool LV, combining cache data LV and cache metadata LV
501
 
# lvconvert --type cache-pool --poolmetadata vg/lvx_cache_meta \\
502
 
        vg/lvx_cache
503
 
 
504
 
4. Create a cached LV by combining the cache pool LV and origin LV
505
 
# lvconvert --type cache --cachepool vg/lvx_cache vg/lvx
506
 
.fi
507
 
 
508
 
.B Example 2:
509
 
Creating a cache LV with a fault tolerant cache pool LV.
510
 
 
511
 
Users who are concerned about the possibility of failures in their fast devices
512
 
that could lead to data loss might consider making their cache pool sub-LVs
513
 
redundant.  Example 2 illustrates how to do that.  Note that only steps
514
 
1 & 2 change.
515
 
 
516
 
.nf
517
 
0. Create an origin LV we wish to cache
518
 
# lvcreate -L 10G -n lvx vg /dev/slow_devs
519
 
 
520
 
1. Create a 2-way RAID1 cache data LV
521
 
# lvcreate --type raid1 -m 1 -L 1G -n lvx_cache vg \\
522
 
        /dev/fast1 /dev/fast2
523
 
 
524
 
2. Create a 2-way RAID1 cache metadata LV
525
 
# lvcreate --type raid1 -m 1 -L 8M -n lvx_cache_meta vg \\
526
 
        /dev/fast1 /dev/fast2
527
 
 
528
 
3. Create a cache pool LV combining cache data LV and cache metadata LV
529
 
# lvconvert --type cache-pool --poolmetadata vg/lvx_cache_meta \\
530
 
        vg/lvx_cache
531
 
 
532
 
4. Create a cached LV by combining the cache pool LV and origin LV
533
 
# lvconvert --type cache --cachepool vg/lvx_cache vg/lvx
534
 
.fi
535
 
 
536
 
.B Example 3:
537
 
Creating a simple cache LV with \fIwritethough\fP caching.
538
 
 
539
 
Some users wish to ensure that any data written will be stored both in the
540
 
cache pool LV and on the origin LV.  The loss of a device associated with
541
 
the cache pool LV in this case would not mean the loss of any data.  When
542
 
combining the cache data LV and the cache metadata LV to form the cache pool
543
 
LV, properties of the cache can be specified - in this case,
544
 
\fIwritethrough\fP vs. \fIwriteback\fP.  Note that only step 3 is affected
545
 
in this case.
546
 
 
547
 
.nf
548
 
0. Create an origin LV we wish to cache (yours may already exist)
549
 
# lvcreate -L 10G -n lvx vg /dev/slow
550
 
 
551
 
1. Create a cache data LV
552
 
# lvcreate -L 1G -n lvx_cache vg /dev/fast
553
 
 
554
 
2. Create a cache metadata LV
555
 
# lvcreate -L 8M -n lvx_cache_meta vg /dev/fast
556
 
 
557
 
3. Create a cache pool LV specifying cache mode "writethrough"
558
 
# lvconvert --type cache-pool --poolmetadata vg/lvx_cache_meta \\
559
 
        --cachemode writethrough vg/lvx_cache
560
 
 
561
 
4. Create a cache LV by combining the cache pool LV and origin LV
562
 
# lvconvert --type cache --cachepool vg/lvx_cache vg/lvx
563
 
.fi
564
 
 
565
 
.SS Removing Cache Logical Volumes
566
 
If you wish to remove all logical volumes associated with a cache
567
 
LV, you must remove both top-level, user-visible devices.
568
 
The cache metadata LV and cache data LV cannot be removed
569
 
directly.  If only the cache pool LV is specfied for removal, any cached
570
 
blocks not yet on the origin LV will be flush, the cache pool LV will be
571
 
removed, and the now un-cached origin LV will remain.  If the user
572
 
specifies a cache LV for removal, then the origin LV is
573
 
removed and only the cache pool LV will remain.  The cache pool LV can then
574
 
be used to create another cache LV with a different origin LV if desired.
575
 
 
576
 
When users intend to remove all logical volumes associated with a
577
 
cache LV, it is generally better to start with the origin LV and then
578
 
remove the cache pool LV.  If the operations are performed in the
579
 
reverse order, the user will have to wait for the contents of the
580
 
cache pool LV to be flushed before the origin LV is removed.  This
581
 
could take some time.
 
434
require more than one command to create.  The cache (\fBlvmcache\fP(7))
 
435
and thin provisioning (\fBlvmthin\fP(7)) types are examples of this.
 
436
 
 
437
.SH SELECTION CRITERIA
 
438
.LP
 
439
The selection criteria are a set of \fBstatements\fP combined by \fBlogical
 
440
and grouping operators\fP. The \fBstatement\fP consists of \fBcolumn\fP
 
441
name for which a set of valid \fBvalues\fP is defined using
 
442
\fBcomparison operators\fP. For complete list of column names (fields)
 
443
that can be used in selection, see the output of \fB<lvm reporting command> -S help\fP.
 
444
.LP
 
445
\fBComparison operators\fP (cmp_op):
 
446
.IP
 
447
\fB=~\fP \(em Matching regular expression.
 
448
.IP
 
449
\fB!~\fP \(em Not matching regular expression.
 
450
.IP
 
451
\fB=\fP  \(em Equal to.
 
452
.IP
 
453
\fB!=\fP \(em Not equal to.
 
454
.IP
 
455
\fB>=\fP \(em Greater than or equal to.
 
456
.IP
 
457
\fB>\fP  \(em Greater than
 
458
.IP
 
459
\fB<=\fP \(em Less than or equal to.
 
460
.IP
 
461
\fB<\fP  \(em Less than.
 
462
.LP
 
463
\fBBinary logical operators\fP (cmp_log):
 
464
.IP
 
465
\fB&&\fP \(em All fields must match
 
466
.IP
 
467
\fB,\fP  \(em All fields must match
 
468
.IP
 
469
\fB||\fP \(em At least one field must match
 
470
.IP
 
471
\fB#\fP  \(em At least one field must match
 
472
.LP
 
473
\fBUnary logical operators\fP:
 
474
.IP
 
475
\fB!\fP  \(em Logical negation
 
476
.LP
 
477
\fBGrouping operators\fP:
 
478
.IP
 
479
\fB(\fP  \(em Left parenthesis
 
480
.IP
 
481
\fB)\fP  \(em Right parenthesis
 
482
.IP
 
483
\fB[\fP  \(em List start
 
484
.IP
 
485
\fB]\fP  \(em List end
 
486
.LP
 
487
\fBInformal grammar specification\fP:
 
488
.IP
 
489
.BR STATEMENT " = " column " cmp_op " VALUE " | " STATEMENT " log_op " STATEMENT " | " (STATEMENT) " | " !(STATEMENT)
 
490
.IP
 
491
.BR VALUE " = " [VALUE " log_op " VALUE]
 
492
.br
 
493
For list-based types: string list. The log_op must always be of one type within the whole list value.
 
494
.IP
 
495
.BR VALUE " = " value
 
496
.br
 
497
For scalar types: number (integer), size (floating point number with size unit suffix), percent (floating point number with or without % suffix), string.
582
498
 
583
499
.SH DIAGNOSTICS
584
500
All tools return a status code of zero on success or non-zero on failure.
588
504
.I $HOME/.lvm_history
589
505
.SH SEE ALSO
590
506
.BR lvm.conf (5),
 
507
.BR lvmcache (7),
 
508
.BR lvmthin (7),
591
509
.BR lvm\ dumpconfig (8),
592
510
.BR clvmd (8),
 
511
.BR dmsetup (8),
593
512
.BR lvchange (8),
594
513
.BR lvcreate (8),
595
514
.BR lvdisplay (8),