linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
From: "Tomas Dalebjörk" <tomas.dalebjork@gmail.com>
To: linux-lvm@redhat.com
Subject: [linux-lvm] vgcfgrestore + pvcreate using liblockdev api in C
Date: Mon, 14 Sep 2020 07:56:19 +0200	[thread overview]
Message-ID: <5CE72DC6-9948-4CB6-83E9-C1F2AE55D5DB@gmail.com> (raw)

hi

Is there an api available today or an example how to perform the below OS commands in C using a function or api instead of system calls?

1. create an unique uid on the server, and store it on the PV disk

# pvcreatue -u <generated uid> <your device>

2. create the LVM metadata backup content (as /etc/lvm/backup/...)
- add PV uid generated above as there is no parameter to save the data to a device
- add unique VG
- add exactly 1 contiguous LV

3. save LVM metadata to the PV disk as the OS command does

# vgcfgrestore VG

Can this be done by instead of using system() calls, instead using native C commands either via an API or other methods?

the examples for bd_lvm_pvcreate() in libblockdevapi for example does not say how to add -u flag
and I couldn’t find any vgcfgrestore there too?

besides this, I found it strange why pvcreate -u is needed at all? would be better to have a <dev> parameter directly to the vgcfgrestore command instead

looking forward to hearing from you soon again 

regards Tomas

Sent from my iPhone

             reply	other threads:[~2020-09-14  5:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-14  5:56 Tomas Dalebjörk [this message]
2020-09-15 11:55 ` [linux-lvm] vgcfgrestore + pvcreate using liblockdev api in C Vojtěch Trefný

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5CE72DC6-9948-4CB6-83E9-C1F2AE55D5DB@gmail.com \
    --to=tomas.dalebjork@gmail.com \
    --cc=linux-lvm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).