LVM-Cache on fresh Ubuntu server install

Matt Graham mhgraham at crow202.org
Fri Jul 8 11:02:13 MST 2016


On 2016-07-08 10:00, Stephen Partington wrote:
> 1T spinning disk and 128G SSD installed. [...] going with LVM-Cache
> Sadly the Ubuntu server installation does not have the option of
> setting up LVM for anything other than its most basic configuration

LVM is complicated, and using LVM-cache is a bit more complicated than 
just making some PVs and putting them into a VG and then making LVs.

> What I understand about LVM is that you can build your LVM group and
> then migrate/expand it without a full install/wipe or 3rd disk device
> to host your core os installation. Can this be done for LVM cache as
> well?

Yes.  Your setup would be something like this:  2 PVs, one on the fast 
disk, one on the slow disk[0].  One VG with both PVs in it.  Multiple 
LVs.  One named root on the fast disk (mounted at / obviously), one 
small one named cache-meta on the fast disk, one larger one named cache 
on the fast disk, and finally one larger one named origin on the slow 
disk.  You'd probably mount the last one on /data or /home or wherever 
makes sense to put the large amount of stuff you want to serve up.  I 
suppose you could put / on the spinny-disk and use almost all of the SSD 
for cache too.  Your call.

If you already have some PVs and LVs set up, you might need to use 
pvmove and lvresize and resize2fs to resize filesystems and LVs and move 
them to the appropriate PV.  These things are of course doable from a 
running system and should not cause any problems.

https://rwmj.wordpress.com/2014/05/22/using-lvms-new-cache-feature/ 
describes all the commands you'd need to run to make this stuff happen.  
And getting an additional 4G or 8G of RAM might help more than using an 
SSD as a cache, depending on what exactly is going on.

(I haven't actually tried this, but I've got a 32G unused partition on 
my SSD right now, and this could be a fun weekend project.  I will let 
you know if I run into any problems.)

[0] With 1T disks as cheap as they are, consider a softRAID-1 instead 
of a single spinny disk.  Disk failures are No Fun At All.

-- 
Crow202 Blog: http://crow202.org/wordpress
There is no Darkness in Eternity
But only Light too dim for us to see.


More information about the PLUG-discuss mailing list