linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] How to place LVM2 metadata to other disks which don't belong to any volume group?
@ 2013-12-11  7:06 George Brian
  2013-12-11 14:19 ` Alasdair G Kergon
  0 siblings, 1 reply; 5+ messages in thread
From: George Brian @ 2013-12-11  7:06 UTC (permalink / raw)
  To: linux-lvm

[-- Attachment #1: Type: text/plain, Size: 192 bytes --]

Hi all,

Instead of storing metadata on PV metadata areas, now I want to store it to
other disks which don't belong to any volume group, just common disk.

thanks for any help.

Best regards,

[-- Attachment #2: Type: text/html, Size: 358 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] How to place LVM2 metadata to other disks which don't belong to any volume group?
  2013-12-11  7:06 [linux-lvm] How to place LVM2 metadata to other disks which don't belong to any volume group? George Brian
@ 2013-12-11 14:19 ` Alasdair G Kergon
  2013-12-13  7:15   ` George Brian
  0 siblings, 1 reply; 5+ messages in thread
From: Alasdair G Kergon @ 2013-12-11 14:19 UTC (permalink / raw)
  To: George Brian; +Cc: linux-lvm

On Wed, Dec 11, 2013 at 03:06:13PM +0800, George Brian wrote:
> Instead of storing metadata on PV metadata areas, now I want to store it to
> other disks which don't belong to any volume group, just common disk.
 
This can indeed be done but because it is not a configuration that receives
much testing you should check the things you want to do work for you in
your particular circumstances.

LVM needs to use one 512-byte sector on the device to label it as a PV
and store its UUID.  By default the 2nd sector is used as this is normally
free.  Read about --labelsector in 'man pvcreate' and use --pvmetadatacopies 0.

Then read about the 'dirs' setting in the 'metadata' section in 'man lvm.conf':

        dirs  — List of directories holding live copies of LVM2 metadata
        as text files.  These directories must not be  on  logical  vol‐
        umes.   It  is possible to use LVM2 with a couple of directories
        here, preferably on different  (non-logical-volume)  filesystems
        and  with  no  other  on-disk  metadata,  pvmetadatacopies  = 0.
        Alternatively these directories can be in addition  to  the  on-
        disk metadata areas.  This feature was created during the devel‐
        opment of the LVM2 metadata  before  the  new  on-disk  metadata
        areas  were  designed and no longer gets tested.  It is not sup‐
        ported under low-memory conditions, and it is important never to
        edit these metadata files unless you fully understand how things
        work: to make changes you should always use the tools as normal,
        or else vgcfgbackup, edit backup, vgcfgrestore.

Alasdair

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] How to place LVM2 metadata to other disks which don't belong to any volume group?
  2013-12-11 14:19 ` Alasdair G Kergon
@ 2013-12-13  7:15   ` George Brian
  2013-12-13 13:50     ` Peter Rajnoha
  2013-12-13 14:31     ` Peter Rajnoha
  0 siblings, 2 replies; 5+ messages in thread
From: George Brian @ 2013-12-13  7:15 UTC (permalink / raw)
  To: George Brian, linux-lvm

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=GB2312, Size: 2295 bytes --]

Hi£¬

thank for your reply.

I read about "lvm.conf" and "man pvcreate" and practice like your
instruction.
but it's hard to meet my expection.

I do as follows:
1, setting lvm.conf to dirs
2, pvcreate --pvmetadatacopies 0
3, vgcreate on pv
Aborting vg_write: No metadata areas to write to!

I indeed want to  store metadata in common disk such as /dev/sdb,
eventually to store all vg's metadata to one singe disk which specially
used to store metadata without data.

thanks




2013/12/11 Alasdair G Kergon <agk@redhat.com>

> On Wed, Dec 11, 2013 at 03:06:13PM +0800, George Brian wrote:
> > Instead of storing metadata on PV metadata areas, now I want to store it
> to
> > other disks which don't belong to any volume group, just common disk.
>
> This can indeed be done but because it is not a configuration that receives
> much testing you should check the things you want to do work for you in
> your particular circumstances.
>
> LVM needs to use one 512-byte sector on the device to label it as a PV
> and store its UUID.  By default the 2nd sector is used as this is normally
> free.  Read about --labelsector in 'man pvcreate' and use
> --pvmetadatacopies 0.
>
> Then read about the 'dirs' setting in the 'metadata' section in 'man
> lvm.conf':
>
>         dirs  ¡ª List of directories holding live copies of LVM2 metadata
>         as text files.  These directories must not be  on  logical  vol©\
>         umes.   It  is possible to use LVM2 with a couple of directories
>         here, preferably on different  (non-logical-volume)  filesystems
>         and  with  no  other  on-disk  metadata,  pvmetadatacopies  = 0.
>         Alternatively these directories can be in addition  to  the  on-
>         disk metadata areas.  This feature was created during the devel©\
>         opment of the LVM2 metadata  before  the  new  on-disk  metadata
>         areas  were  designed and no longer gets tested.  It is not sup©\
>         ported under low-memory conditions, and it is important never to
>         edit these metadata files unless you fully understand how things
>         work: to make changes you should always use the tools as normal,
>         or else vgcfgbackup, edit backup, vgcfgrestore.
>
> Alasdair
>
>

[-- Attachment #2: Type: text/html, Size: 3489 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] How to place LVM2 metadata to other disks which don't belong to any volume group?
  2013-12-13  7:15   ` George Brian
@ 2013-12-13 13:50     ` Peter Rajnoha
  2013-12-13 14:31     ` Peter Rajnoha
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Rajnoha @ 2013-12-13 13:50 UTC (permalink / raw)
  To: LVM general discussion and development, George Brian

On 12/13/2013 08:15 AM, George Brian wrote:
> Hi,
> 
> thank for your reply.
> 
> I read about "lvm.conf" and "man pvcreate" and practice like your
> instruction.
> but it's hard to meet my expection.
> 
> I do as follows:
> 1, setting lvm.conf to dirs
> 2, pvcreate --pvmetadatacopies 0
> 3, vgcreate on pv 
> Aborting vg_write: No metadata areas to write to!
> 

Make sure you have the "metadata" section uncommented for the
"dirs" setting to take effect.

-- 
Peter

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] How to place LVM2 metadata to other disks which don't belong to any volume group?
  2013-12-13  7:15   ` George Brian
  2013-12-13 13:50     ` Peter Rajnoha
@ 2013-12-13 14:31     ` Peter Rajnoha
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Rajnoha @ 2013-12-13 14:31 UTC (permalink / raw)
  To: LVM general discussion and development, George Brian

On 12/13/2013 08:15 AM, George Brian wrote:
> I indeed want to  store metadata in common disk such as /dev/sdb, 
> eventually to store all vg's metadata to one singe disk which specially
> used to store metadata without data.
> 

This is probably not directly supported, but you should be able to achieve
what you want by using two-level LVM layout:

  - (step 1) you could create a PV/VG on /dev/sdb, let's call it VG_A

  - (step 2) then create LV with the size just to store the metadata,
    let's call it LV_A. This is the first level - the A level.

  - (step 3) then create a PV on LV_A (with 1-2 metadatacopies), then make PVs
    from others disk with 0 metadatacopies, then group it into a VG_B.
    That's the second level - the B level.

  - (repeat step 2 and 3 for as many other VGs as you need)

So you have a dedicated /dev/sdb disk to store metadata for as many VGs
as you want (and as the disk space allows) and just store data on any other disks.

Or to be more concrete with commands (just a quick example):

  pvcreate /dev/sdb
  vgcreate -s 1M VG_A /dev/sdb

  lvcreate -l 1M VG_A -n LV_A_0
  pvcreate /dev/VG_A/LV_A_0
  pvcreate --metadatacopies 0 /dev/sda ... (or whatever other disks)
  vgcreate VG_B_0 /dev/VG_A/LV_A_0 /dev/sda
  lvcreate -L1G -n my_lv1_to_use VG_B_0
  lvcreate -L1G -n my_lv2_to_use VG_B_0
  ...

  lvcreate -l 1M VG_A -n LV_A_1
  pvcreate /dev/VG_A/LV_A_1
  pvcreate --metadatacopies 0 /dev/sdc ... (or whatever other disks)
  vgcreate VG_B_1 /dev/VG_A/LV_A_1 /dev/sdc
  lvcreate -L1G -n another_lv1_to_use VG_B_1
  ...
  ..

With such setup, you need to activate the level A VG first with the LVs
storing PVs with metadata and after that level B VGs that use the metadata.
It's not a problem when LVM volumes are autoactivated based on events with
the help of lvmetad (global/use_lvmetad=1 lvm.conf option), otherwise you
need to call vgchange -ay twice.

(Also, if you like more manual tweaking, you can just create mappings yourself
with dmesetup to accomplish step 2. But with LVs it's easier to manage.
So there are several ways how to achieve that as a matter of fact...).

-- 
Peter

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-12-13 14:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-11  7:06 [linux-lvm] How to place LVM2 metadata to other disks which don't belong to any volume group? George Brian
2013-12-11 14:19 ` Alasdair G Kergon
2013-12-13  7:15   ` George Brian
2013-12-13 13:50     ` Peter Rajnoha
2013-12-13 14:31     ` Peter Rajnoha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).