When caching an LV with dm-cache, a cache pool stores cached data and metadata. The cache pool is associated with a specific LV. Frequently accessed blocks are cached, while less frequently accessed blocks remain on slower storage.
Procedure
-
Display the LV you want to cache and its volume group:
LV VG
LogicalVolumeName VolumeGroupName
-
Create the cache pool:
# lvcreate --type cache-pool --name CachePoolName --size Size VolumeGroupName /FastDevicePath
Replace CachePoolName with the name of the cache pool. Replace Size with the size for your cache pool. Replace VolumeGroupName with the name of the volume group. Replace /FastDevicePath with the path to your fast device, for example SSD or NVME.
-
Attach the cache pool to the LV:
# lvconvert --type cache --cachepool VolumeGroupName/CachePoolNameVolumeGroupName/LogicalVolumeName
Results
- Verify that the LV is now cached:
LV Pool
LogicalVolumeName [CachePoolName_cpool]