How to: Change LVM Cache / dm-cache mode

LVM2 has a built in cache feature to use slow disk with SSDs. Although, by default, it changes the cache to use Writethrough. If you have a battery backed unit with RAIDed SSDs, you may want to use Writeback cache mode to achive faster write performance. 

To find current cache mode, you can run the following on the cached pool:

# lvs -o+cache_mode vg0_727b_121217/vpsextra
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert CacheMode
vpsextra vg0_727b_121217 Cwi-aoC--- 3.00t [cache] [vpsextra_corig] 5.45 0.73 0.00 writethrough


To change the CacheMode to Writeback, use the following:

# lvchange --cachemode writeback vg0_727b_121217/vpsextra
Logical volume vg0_727b_121217/vpsextra changed.

Check the current CacheMode:

# lvs -o+cache_mode vg0_727b_121217/vpsextra
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert CacheMode
vpsextra vg0_727b_121217 Cwi-aoC--- 3.00t [cache] [vpsextra_corig] 5.48 1.08 0.07 writeback

  • lvm cache, dm-cache, ssd cache, lvm, centos
  • 2 Benutzer fanden dies hilfreich
War diese Antwort hilfreich?

Verwandte Artikel

LVM Cheatsheet

To install LVM2 in CentOS/Redhat servers: yum install lvm2 1. Add a partition to physical...

How to: Extend LVM partition

To increase the partition lv0 under volume group vg0 by 50GB, use lvextend command: lvextend...

How to: LVM Snapshot

LVM snapshot can be useful for filesystem integrity check and backups. A snapshot of size 15GB...

How to: Device Mapper Number to LV Name

It is often confusing when device mapper number appears while troubleshooting in place of logical...

How to: Repair a lvm thin pool

Sometimes there can be error like the following:Thin's thin-pool needs inspection.It can appear...