Changes between Version 3 and Version 4 of lvm-cache


Ignore:
Timestamp:
Sep 9, 2020, 10:37:45 PM (2 weeks ago)
Author:
JaimeV
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • lvm-cache

    v3 v4  
    11[[PageOutline]]
    22
     3= Logical Volume Caching =
     4
    35An 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.
     6
     7lvmcache uses lvm as a frontend to dm-cache which is part of the kernel ​https://en.wikipedia.org/wiki/Dm-cache
     8
     9More documentation:
     10
     11​https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/logical_volume_manager_administration/lvm_cache_volume_creation
     12
     13​https://manpages.ubuntu.com/manpages/eoan/man7/lvmcache.7.html
     14
    415
    516== Setup lvm cache ==
     
    2738}}}
    2839
    29 ===What just happened?===
     40**What just happened?**
    3041
    31 LVM automatically created both a data cache lv and a metadata cache lv and combined those 2 into a cachepool. It then created a cached logical volume by linking the cachepool to the origin disk. The resulting cache volume assumes the name of the origin disk.
     42LVM automatically created both a data cache lv and a metadata cache lv from the new block device and combined those 2 into a cachepool. It then created a cached logical volume by linking the cachepool to the origin disk. The resulting cache volume assumes the name of the origin disk.
    3243
    3344== Disabling the cache ==
     
    7384== More Details ==
    7485
     86=== LVM cache logical volume types ===
     87
    7588LVM caching uses the following LVM logical volume types. All of these associated logical volumes must be in the same volume group.
    7689
    7790* Origin logical volume  the large, slow logical volume
    78 * 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
    79     * Cache data logical volume  the logical volume containing the data blocks for the cache pool logical volume
    80     * 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).
    81 * 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.
    82 * Spare metadata logical volume. This is related to a metadata failure-recovery feature. See: ​https://manpages.debian.org/stretch/lvm2/lvmthin.7.en.html#Spare_metadata_LV "If thin pool metadata is damaged, it may be repairable. Checking and repairing thin pool metadata is analagous to running fsck on a file system." Another explanation: ​https://rwmj.wordpress.com/2014/05/22/using-lvms-new-cache-feature/#comment-10152
     91* **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
     92    * **Cache data logical volume**  the logical volume containing the data blocks for the cache pool logical volume
     93    * **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).
     94* **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.
     95* **Spare metadata logical volume** This is related to a [​https://manpages.debian.org/stretch/lvm2/lvmthin.7.en.html#Spare_metadata_LV metadata failure-recovery feature]. "If thin pool metadata is damaged, it may be repairable. Checking and repairing thin pool metadata is analagous to running fsck on a file system." Another explanation: ​https://rwmj.wordpress.com/2014/05/22/using-lvms-new-cache-feature/#comment-10152
    8396
    84 When creating the cache Cachemode has two possible options:
     97=== Cachemode ===
     98
     99When creating the cache **cachemode** has two possible options:
    85100
    86101* **writethrough** ensures that any data written will be stored both in the cache pool LV and on the origin LV. The loss of a device associated with the cache pool LV in this case would not mean the loss of any data;
    87102* **writeback** ensures better performance, but at the cost of a higher risk of data loss in case the drive used for cache fails.
    88103
    89 In the exmaples above we've opted for writeback because the logical volume created for the cache on the physical host is backed by a RAID1 array created from two SSD drives so we already have a lower level of protection against drive failure in place. Choose wisely.
     104In the examples above we've opted for writeback because the logical volume created for the cache on the physical host is backed by a RAID1 array created from two SSD drives so we already have a lower level of protection against drive failure in place. Choose wisely.
    90105
     106=== Do not exhaust space on "metadadata" logical volume ===
    91107
    92 More details:
    93 
    94 ​https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/logical_volume_manager_administration/lvm_cache_volume_creation
    95 
    96 ​https://manpages.ubuntu.com/manpages/eoan/man7/lvmcache.7.html
     108We should not allow the "metadadata" volume of an lvm cachepool to exhaust its available space. In the man pages there is documentation about what happens to lvm thinpool when it reaches metadata space exhaustion and it sounds all bad. ​https://www.systutorials.com/docs/linux/man/7-lvmthin/#lbAY