Changes between Version 3 and Version 4 of lvm-cache
- Timestamp:
- Sep 10, 2020, 2:37:45 AM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
lvm-cache
v3 v4 1 1 [[PageOutline]] 2 2 3 = Logical Volume Caching = 4 3 5 An 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 7 lvmcache uses lvm as a frontend to dm-cache which is part of the kernel https://en.wikipedia.org/wiki/Dm-cache 8 9 More 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 4 15 5 16 == Setup lvm cache == … … 27 38 }}} 28 39 29 ===What just happened?=== 40 **What just happened?** 30 41 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.42 LVM 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. 32 43 33 44 == Disabling the cache == … … 73 84 == More Details == 74 85 86 === LVM cache logical volume types === 87 75 88 LVM caching uses the following LVM logical volume types. All of these associated logical volumes must be in the same volume group. 76 89 77 90 * Origin logical volume the large, slow logical volume 78 * Cache pool logical volumethe small, fast logical volume, which is composed of two devices: the cache data logical volume, and the cache metadata logical volume79 * Cache data logical volumethe logical volume containing the data blocks for the cache pool logical volume80 * Cache metadata logical volumethe 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 volumethe 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-1015291 * **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 83 96 84 When creating the cache Cachemode has two possible options: 97 === Cachemode === 98 99 When creating the cache **cachemode** has two possible options: 85 100 86 101 * **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; 87 102 * **writeback** ensures better performance, but at the cost of a higher risk of data loss in case the drive used for cache fails. 88 103 89 In the ex maples 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.104 In 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. 90 105 106 === Do not exhaust space on "metadadata" logical volume === 91 107 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 108 We 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