269
288
\fIanywhere\fP will - even if that reduces performance by
270
289
placing two stripes on the same Physical Volume.
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.
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.
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).
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
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.
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
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
426
The steps to create a logical volume of \fIcache\fP type are as follows:
429
Create an LV or identify an existing LV to be the origin LV.
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.
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.
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.
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
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.
464
lvcreate -L LargeSize -n OriginLV VG SlowPVs
466
1. create CacheDataLV
467
lvcreate -L CacheSize -n CacheDataLV VG FastPVs
469
2. create CacheMetaLV
470
lvcreate -L MetaSize -n CacheMetaLV VG FastPVs
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.
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.
487
Creating a simple cache LV.
491
0. Create the origin LV
492
# lvcreate -L 10G -n lvx vg /dev/slow_dev
494
1. Create a cache data LV
495
# lvcreate -L 1G -n lvx_cache vg /dev/fast_dev
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
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 \\
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
509
Creating a cache LV with a fault tolerant cache pool LV.
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
517
0. Create an origin LV we wish to cache
518
# lvcreate -L 10G -n lvx vg /dev/slow_devs
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
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
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 \\
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
537
Creating a simple cache LV with \fIwritethough\fP caching.
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
548
0. Create an origin LV we wish to cache (yours may already exist)
549
# lvcreate -L 10G -n lvx vg /dev/slow
551
1. Create a cache data LV
552
# lvcreate -L 1G -n lvx_cache vg /dev/fast
554
2. Create a cache metadata LV
555
# lvcreate -L 8M -n lvx_cache_meta vg /dev/fast
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
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
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.
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.
437
.SH SELECTION CRITERIA
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.
445
\fBComparison operators\fP (cmp_op):
447
\fB=~\fP \(em Matching regular expression.
449
\fB!~\fP \(em Not matching regular expression.
451
\fB=\fP \(em Equal to.
453
\fB!=\fP \(em Not equal to.
455
\fB>=\fP \(em Greater than or equal to.
457
\fB>\fP \(em Greater than
459
\fB<=\fP \(em Less than or equal to.
461
\fB<\fP \(em Less than.
463
\fBBinary logical operators\fP (cmp_log):
465
\fB&&\fP \(em All fields must match
467
\fB,\fP \(em All fields must match
469
\fB||\fP \(em At least one field must match
471
\fB#\fP \(em At least one field must match
473
\fBUnary logical operators\fP:
475
\fB!\fP \(em Logical negation
477
\fBGrouping operators\fP:
479
\fB(\fP \(em Left parenthesis
481
\fB)\fP \(em Right parenthesis
483
\fB[\fP \(em List start
485
\fB]\fP \(em List end
487
\fBInformal grammar specification\fP:
489
.BR STATEMENT " = " column " cmp_op " VALUE " | " STATEMENT " log_op " STATEMENT " | " (STATEMENT) " | " !(STATEMENT)
491
.BR VALUE " = " [VALUE " log_op " VALUE]
493
For list-based types: string list. The log_op must always be of one type within the whole list value.
495
.BR VALUE " = " value
497
For scalar types: number (integer), size (floating point number with size unit suffix), percent (floating point number with or without % suffix), string.
584
500
All tools return a status code of zero on success or non-zero on failure.