LVM-Cache on fresh Ubuntu server install

Stephen Partington cryptworks at gmail.com
Fri Jul 8 11:41:23 MST 2016


wow, that was much smoother than i thought it would be.

I guess setting things up the way i have ahead of time was a good thing.
now to move on to the rest of life. (also an interesting idea to set up a
desktop/laptop this way to see how life works)

lvm> vgs
  VG     #PV #LV #SN Attr   VSize VFree
  System   2   1   0 wz--n- 1.02t 1.38g
lvm> pvs
  PV         VG     Fmt  Attr PSize   PFree
  /dev/sda3  System lvm2 a--  117.38g 1.38g
  /dev/sdb2  System lvm2 a--  922.20g    0
lvm> lvs
  LV     VG     Attr       LSize   Pool    Origin         Data%  Meta%
 Move Log Cpy%Sync Convert
  System System Cwi-aoC--- 922.20g [cache] [System_corig] 0.00   0.70
     0.00


On Fri, Jul 8, 2016 at 11:24 AM, Stephen Partington <cryptworks at gmail.com>
wrote:

> ​The biggest issue i have is that i am working with a mac mini. the 1T
> drive is a 5400 rpm drive. this has been my home server for a while running
> server 2016, but it is time to put something more useful on it.
>
> Part of this is specifically to learn how to use lvm and lvmcache.​ And
> ram is on the list for this server just not in the budget yet.
>
> I am not worried about catastrophic failure or the like as nothing lives
> on this server that does not already live anywhere else.
>
> I did the install with the Ubuntu server install so i could at least get
> lvm set up partly ahead of time. so it looks like I am in a good place. I
> was reading that article as i received your email.
>
> So now to extend the vg create the cache and meta lv's and turn things on.
>
> 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
> lvm> vgdisplay
>   --- Volume group ---
>   VG Name               System
>   System ID
>   Format                lvm2
>   Metadata Areas        1
>   Metadata Sequence No  2
>   VG Access             read/write
>   VG Status             resizable
>   MAX LV                0
>   Cur LV                1
>   Open LV               1
>   Max PV                0
>   Cur PV                1
>   Act PV                1
>   VG Size               922.20 GiB
>   PE Size               4.00 MiB
>   Total PE              236082
>   Alloc PE / Size       236082 / 922.20 GiB
>   Free  PE / Size       0 / 0
>
>
> On Fri, Jul 8, 2016 at 11:02 AM, Matt Graham <mhgraham at crow202.org> wrote:
>
>> 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.
>> ---------------------------------------------------
>> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org
>> To subscribe, unsubscribe, or to change your mail settings:
>> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>>
>
>
>
> --
> A mouse trap, placed on top of your alarm clock, will prevent you from
> rolling over and going back to sleep after you hit the snooze button.
>
> Stephen
>
>


-- 
A mouse trap, placed on top of your alarm clock, will prevent you from
rolling over and going back to sleep after you hit the snooze button.

Stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phxlinux.org/pipermail/plug-discuss/attachments/20160708/976ef778/attachment.html>


More information about the PLUG-discuss mailing list