Friday, July 8, 2016

Ubuntu 16.04 home server and LVM-Cache

So I wanted to rebuild my home server (Mac Mini) which has a 128GB SSD and 1TB 5400 rpm drive.

I first started with information from the lvmcache manpage and a blogpost.
http://manpages.ubuntu.com/manpages/wily/man7/lvmcache.7.html
https://rwmj.wordpress.com/2014/05/22/using-lvms-new-cache-feature/

Doing some planning and setting up LVM during the 16.04 server install I had a final configuration of :
lvm> pvscan
  PV /dev/sdb2   VG System          lvm2 [922.20 GiB / 0    free]
  PV /dev/sda3                      lvm2 [117.38 GiB]
  Total: 2 [1.02 TiB] / in use: 1 [922.20 GiB] / in no VG: 1 [117.38 GiB]
lvm> pvs
  PV         VG     Fmt  Attr PSize   PFree
  /dev/sda3         lvm2 ---  117.38g 117.38g
  /dev/sdb2  System lvm2 a--  922.20g      0
lvm> vgs
  VG     #PV #LV #SN Attr   VSize   VFree
  System   1   1   0 wz--n- 922.20g    0

I did this with a manual configuration as follows
sda (SSD)
sda1 = 1GB /boot
sda2 = 1GB EFI partition
sda3 = remaining space set as LVM

sdb (HDD)
sdb1 = 10gb swap
sdb2 = LVM

I then used the installers lvm tool to create the lvm needed
1 group that was only on the lvm disk from sdb2 this was then my root (/) partition

I then installed the system as normal. then i used Richard WM Jones article (https://rwmj.wordpress.com/2014/05/22/using-lvms-new-cache-feature/) to enable lvmcache. this was just about perfect until reboot.

The part I missed is that lvmcache relies on dm-raid and its caching and they need to be part of the kernel and not a kernel module if you are using it as your main system partiton. (see http://unix.stackexchange.com/questions/173704/booting-from-an-lvm-cached-volume and http://scyu.logdown.com/posts/519001-ubuntu-lvmcache-setup)

So I start over with a clean install and rebuild as I had before, this time making sure to have dmraid and the related tools installed and built into my kernel (apt install dmraid thin-provisioning-tools specifically) and a full upgrade to get everything in place.

After doing that and the apt upgrade-all and making sure I followed the steps in http://scyu.logdown.com/posts/519001-ubuntu-lvmcache-setup to create the needed files I now have a fully functioning ssd cached home server.

And there is a noticeable difference in boot and general utilization from the 5400rpm drive to the lvmached disk.


No comments:

Post a Comment