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
  • I would imagine lvconvert --type linear anson-TA75MH2/root. – psusi Jan 17 '15 at 21:43
  • 1
    @psusi Running that just now gave me WARNING: Unrecognised segment type linear \n Conversion using --type linear is not supported. – AJMansfield Jan 17 '15 at 21:44
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.


The lvmcache(7) manpage describes how you can remove the cache pool without removing its origin volume:

Removing a cache pool LV without removing its linked origin LV

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

lvremove VG/CachePoolLV


# lvs vg
  LV     VG   Attr       LSize   Pool   Origin
  cache0 vg   Cwi---C---  10.00g
  lvol0  vg   Cwi-a-C--- 100.00g cache0 [lvol0_corig]

# lvremove vg/cache0

# lvs vg
  LV    VG   Attr       LSize   Pool Origin
  lvol0 vg   -wi-a----- 100.00g

So in my case, I would do lvremove anson-TA75MH2/lv_cache. This does nessesitate recreating the cache pool from scratch, but that is OK, just slightly bothersome. (I plan on doing this within the next few minutes if nobody posts anything better.)

  • Did it work as expected? – sdkks May 27 '17 at 8:23
  • @sdkks Yes, it worked. – AJMansfield May 27 '17 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.