NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Beating a dead horse



On Thu, Nov 26, 2015 at 07:43:50PM +0700, Robert Elz wrote:
> 
>   | LVM scans for devices and has a filter regex configured in
>   | /etc/lvm/lvm.conf.
> 
> OK, I think that wasn't the problem ... I tried everything I could think
> of as the filter list in there, with and without /dev/ (and with and
> without /dev/ as the arg to lvcreate and nothing made a difference).


This list will scan only wedges for PVs.

        filter = [ "a|rdk[0-9]*|", "r|.*|" ]


> That's enough for me to conclude that lvm doesn't work (properly) with
> 4k sector size disks either - that is, I made a vg, on the pv, and looked
> at its size and it (just like cgd) is 1/8 of the size that it should be.


The LVM code (function _dev_get_size_dev) only determines the sector count
but assumes 512 byte sectors.

But you can fake the value with pvcreate --setphysicalvolumesize.
This is written into the LVM label and that's the only thing that
the rest of the LVM code is interested in.

sd0 is a disk with 1k sectors.

gpt add -l pv1 -s 10m -t linux-lvm sd0
gpt add -l pv2 -s 10m -t linux-lvm sd0
gpt add -l pv3 -s 10m -t linux-lvm sd0
dkctl sd0 makewedges

creates

dk8 at sd0: pv1
dk8: 10240 blocks at 16000018, type: 
dk10 at sd0: pv2
dk10: 10240 blocks at 16010258, type: 
dk12 at sd0: pv3
dk12: 10240 blocks at 16020498, type: 

This labels the PVs

lvm pvcreate --setphysicalvolumesize 10m /dev/rdk{8,10,12}

  PV         VG   Fmt  Attr PSize PFree
  /dev/rdk10 vg1  lvm2 a-   8.00m    0 
  /dev/rdk12 vg1  lvm2 a-   8.00m    0 
  /dev/rdk5  vg0  lvm2 a-   5.46t 4.86t
  /dev/rdk6  vg0  lvm2 a-   5.46t 5.46t
  /dev/rdk8  vg1  lvm2 a-   8.00m    0 

and this creates the VG and LV

lvm vgcreate vg1 /dev/rdk{8,10,12}

  VG   #PV #LV #SN Attr   VSize  VFree 
  vg0    2   3   0 wz--n- 10.92t 10.32t
  vg1    3   1   0 wz--n- 24.00m 24.00m

lvcreate -L 24m -n lv1 vg1

  LV    VG   Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  test  vg0  -wi-a-   4.00g                                      
  test3 vg0  -wi-a-   4.00g                                      
  test4 vg0  -wi-a- 600.00g                                      
  lv1   vg1  -wi-a-  24.00m                             




Greetings,
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index