Changes between Initial Version and Version 1 of lvm-cache


Ignore:
Timestamp:
Sep 10, 2020, 1:40:47 AM (4 years ago)
Author:
JaimeV
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • lvm-cache

    v1 v1  
     1An lvm cache logical volume uses a small logical volume consisting of fast block devices (such as SSD drives) to improve the performance of a larger and slower logical volume ( like spinning disks ) by storing the frequently used blocks on the smaller, faster logical volume.
     2
     3== Setup lvm cache ==
     4
     5To setup lvm cache for a logical volume on one of our virtual servers observe the following steps
     6
     7* make sure the {{{thin-provisioning-tools}}} package in installed
     8* [https://support.mayfirst.org/wiki/ssd#Addingsolidstatedrivestoaguest add an additional SSD based block device to the virtual guest] but do not create a new filesystem or modify the new block device
     9* add the new block device as a physical volume for the same volume group of the disk you want to cache
     10
     11In the example below our new block device is {{{/dev/sdb}}} but it will not always be, make sure you have correctly identified the correct empty block device and change the command accordingly. In this example we plan on caching the logical volume "home" that belongs to volume group vg_erica0 , so we'll add our new block device to vg_erica0
     12
     13{{{
     14# vgextend vg_erica0 /dev/sdb
     15}}}
     16
     17== Enabling the cache ==
     18
     19Creating the cache is a multistep process but we can automate most of it with one command. In the example below vg_erica0/home is the logical volume we want to cache and /dev/sdb is our new SSD block device.
     20
     21{{{
     22# lvcreate --type cache --cachemode writeback -l 100%FREE --name home_cachepool vg_erica0/home /dev/sdb
     23  Using 96.00 KiB chunk size instead of default 64.00 KiB, so cache pool has less than 1000000 chunks.
     24  Logical volume vg_erica0/home is now cached.
     25}}}
     26
     27== Disabling the cache ==
     28
     29{{{
     30# lvconvert --uncache vg_erica0/home
     31  Flushing 6 blocks for cache vg_erica0/home.
     32  Flushing 4 blocks for cache vg_erica0/home.
     33  Logical volume "home_cachepool" successfully removed
     34  Logical volume vg_erica0/home is not cached.
     35}}}
     36
     37== Examining the cache ==
     38
     39{{{
     40# lvs -a
     41  home                   vg_ossie0 Cwi-aoC--- 889.00g [home_cachepool] [home_corig] 0.46   16.21           71.37           
     42  [home_cachepool]       vg_ossie0 Cwi---C--- <90.14g                               0.46   16.21           71.37           
     43  [home_cachepool_cdata] vg_ossie0 Cwi-ao---- <90.14g                                                                     
     44  [home_cachepool_cmeta] vg_ossie0 ewi-ao----  48.00m                                                                     
     45  [home_corig]           vg_ossie0 owi-aoC--- 889.00g
     46}}}
     47
     48== More Details ==
     49
     50  LVM caching uses the following LVM logical volume types. All of these associated logical volumes must be in the same volume group.
     51
     52* Origin logical volume  the large, slow logical volume
     53* Cache pool logical volume  the small, fast logical volume, which is composed of two devices: the cache data logical volume, and the cache metadata logical volume
     54    * Cache data logical volume  the logical volume containing the data blocks for the cache pool logical volume
     55    * Cache metadata logical volume  the logical volume containing the metadata for the cache pool logical volume, which holds the accounting information that specifies where data blocks are stored (for example, on the origin logical volume or the cache data logical volume).
     56* Cache logical volume the logical volume containing the origin logical volume and the cache pool logical volume. This is the resultant usable device which encapsulates the various cache volume components.