How to stop caching a LVM partition

lvmpartition

I currently have LVM-cache set up on my Ubuntu install as described in https://rwmj.wordpress.com/2014/05/22/using-lvms-new-cache-feature/. (I did have to install some of the vivid/proposed packages to get it to work, but I managed.)

I was able to successfully convert one of my logical volumes into a cached volume, via:

# lvconvert --type cache --cachepool anson-TA75MH2/lv_cache anson-TA75MH2/root
  Logical volume anson-TA75MH2/root is now cached.

However, after doing this, I am unable to resize the cached partition.

When I try to extend the cached partition (in this case named root, since it is going to be the root of my filesystem), I get an error message:

# lvextend anson-TA75MH2/root -L +250G
  Unable to resize logical volumes of cache type.

How can I turn the caching back off, so that I can resize it?

For reference:

sda is my main 1TB hard drive, containing a large LVM partition and a shrunken ext4 partition that I plan to move into lvm. sdb is a cheap 32GB SSD, with a 500MB ext2 /boot partition, a big lvm partition, and 8GB of swap.

# vgs
  VG            #PV #LV #SN Attr   VSize   VFree  
  anson-TA75MH2   2   3   0 wz--n- 803.46g 499.96g
# pvs
  PV         VG            Fmt  Attr PSize   PFree  
  /dev/sda1  anson-TA75MH2 lvm2 a--  782.47g 499.96g
  /dev/sdb2  anson-TA75MH2 lvm2 a--   21.00g      0 
# lvs
  LV       VG            Attr       LSize   Pool     Origin       Data%  Meta%  Move Log Cpy%Sync Convert
  home     anson-TA75MH2 -wi-ao---- 250.47g                                                              
  lv_cache anson-TA75MH2 Cwi---C---  20.96g                                                              
  root     anson-TA75MH2 Cwi-aoC---  32.00g lv_cache [root_corig]

Alternately, if there is a way to instead cache more than one LV using the same cache, that would be preferred (although I would still like to know how to turn it off). However, when I try it, it refuses:

# lvconvert --type cache --cachepool anson-TA75MH2/lv_cache anson-TA75MH2/home
  lv_cache is already in use by root

Best Answer

lvconvert --uncache anson-TA75MH2/root

seems less susceptible to catastrophic typos than

lvremove anson-TA75MH2/lv_cache

but like the man page said those are the main options.

Related Question