Using LVM cache Logical Volume, you can attach a LV on SSD to a large SATA disk as a cache layer to boost IOPS, largely improve your IO capacity without paying much investment on existing storage devices. Further more, you can even detatch and reattach a SSD to other SATA LVs when needed.

How to remove cache SSD LV off LVM cache Logical Volume?

 

Suppose here is the way you created cache LV(skip PV creation, sdb is a SATA drive, while sdd is a SDD)

       0. Create an origin LV we wish to cache
       # lvcreate -L 1000G -n satalv vg /dev/sdb

       1. Create a cache data LV
       # lvcreate -L 100G -n datacache vg /dev/ssd

       2. Create a cache metadata LV
       # lvcreate -L 100M -n metacache vg /dev/ssd

       3. Create a cache pool LV
       # lvconvert --type cache-pool --poolmetadata vg/metacache vg/datacache

       4. Create a cache LV by combining the cache pool LV and origin LV, 
and use the writethrough cache mode. # lvconvert --type cache --cachepool vg/cachedLV --cachemode writethrough vg/satalv

Remove cache from LVM cached LV

Basically there are three ways to remove cache pool lv from origin LV, one is just detatch, the other is detatch and delete the cache pool LV from system, the third is to remove both cache pool lv and origin lv.

Here are they

Split cache pool lv off origin LV, without removing origin LV

A cache pool LV can be splited off from a cached LV without changing the origin LV.  Also, the disconnected cache pool LV can be reused to attache to other LVs.

This command also writes cached data in the cache pool to the origin LV.

#lvconvert --splitcache VG/cachedLV

Reattach a cache pool LV to another LV

Same as mentioned in previous section, a splitted off cache pool LV can be reattached to the other origin LV.

Use the writethrough cache mode.

# lvconvert --type cache --cachepool vg/cachedLV --cachemode writethrough vg/othersatalv

Remove cache pool lv from origin LV, without removing origin LV

This writes back data from the cache pool to the origin LV when necessary, then removes the cache pool LV, leaving the uncached origin LV.

#lvremove VG/CachePoolLV

An alternative command that also disconnects the cache pool from the cache LV, and deletes the cache pool:

#lvconvert --uncache VG/CachedLV

Remove both cache pool lv and origin LV

Removing a cache LV removes both the origin LV and the linked cache pool LV.

# lvremove VG/CacheLV