LVM Cache

blkid -o list

lsblk

fdisk /dev/vda


Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p):
Using default response p
Partition number (3,4, default 3):
First sector (33239040-52428799, default 33239040):
Using default value 33239040
Last sector, +sectors or +size{K,M,G} (33239040-52428799, default 52428799): +5G
Partition 3 of type Linux and of size 5 GiB is set

Command (m for help): t
Partition number (1-3, default 3):
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

[root@ip ~]# partprobe


e2label /dev/vda3 "LVM Cache"

lvmdiskscan

pvcreate /dev/vda3

 pvdisplay

pvscan
vgextend centos7 /dev/vda3

 lvcreate --type cache-pool -L 4.9G -n cpool centos7 /dev/vda3
    lvs -a -o name,size,attr,devices centos7
 lvconvert --type cache --cachepool cpool centos7/root
lvs -a -o name,size,attr,devices centos7


lvcreate --type cache-pool -L 5.9G -n cpool storage /dev/vdb2

lvconvert --type cache --cachepool cpool storage/website

lvmdiskscan

  lvs -a -o +devices storage

 lvs -a -o name,size,attr,devices storage

Stop CACHING  lvremove /dev/storage/storage_snapshot