linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Peter Rajnoha <prajnoha@redhat.com>
To: Karel Zak <kzak@redhat.com>
Cc: henson@acm.org, linux-lvm@redhat.com
Subject: Re: [linux-lvm] Identifying useable block devices
Date: Fri, 17 Jan 2014 10:53:31 +0100	[thread overview]
Message-ID: <52D8FD9B.5060701@redhat.com> (raw)
In-Reply-To: <20140117092921.GA5869@x2.net.home>

On 01/17/2014 10:29 AM, Karel Zak wrote:
> On Fri, Jan 17, 2014 at 08:54:15AM +0100, Peter Rajnoha wrote:
>> Well, that is probably an RFE for util-linux to give priority to
>> /dev/<vgname>/<lvname> instead of /dev/mapper/<vgname>-<lvname>
>> if it's available...
>>
>> Karel, would that be possbible for you to add? (though I expect
>> you probably don't want to add any additional and specific logic
>> for dm devices :) )
> 
> I have spent years to move from /dev/dm-N to /dev/mapper/<name> ... :-)
> 
> Note that /dev/mapper/<name> paths are in many cases composed from
> /sys/block/dm-<N>/dm/name and this sysfs file has been added (by
> Milan) just to support conversion from random DM paths (or devno) to
> the canonicalized /dev/mapper/<name>.
> 
> How I can convert maj:min or /dev/dm-N to /dev/vg/vol path? Is the
> volume group name (always) in /sys/block/dm-<N>/dm/name and (always)
> separated by "-" ?
> 

It would require more steps for LVM:
 - you would need to look at the /sys/block/dm-<N>/dm/uuid
 - if the UUID has "LVM-" prefix, it's LVM device
 - the you would need to translate the /sys/block/dm-<N>/dm/name
   into its VG and LV part (it's always separated by "-", if the
   VG or LV name itself contains "-", escaped form of this char is used
   which is "--").
 - then check whether /dev/<vgname>/<lvname> exists and use it if yes

Similarly for any other DM subsystem that has its own naming
logic and priorities with respect to /dev content (not sure at the
moment if mpath or cryptsetup has any, probably not).

> It also seems that this is LVM specific, for non-LVM devices (for 
> example LUKS) we want to use /dev/mapper/<name>.

Sure, this is LVM specific only (as well as it would be for any other
DM subsystem). The only thing here is to make people use the more
approriate /dev/<vgname>/<lvname> instead of /dev/mapper because
otherwise if they see /dev/mapper on output, they just use this.

However, frankly, I can imagine that someone somewhere already uses
(incorrectly) the comparison of the path found on output of util-linux
utilities with "mapper" to say that this is the dm device and make
decisions based on that - that can become broken then...

This is more a cosmetic change. The exact same logic can be used
in all those scripts that try to identify which LV is for internal
use only (and so they should avoid processing the device). But in that
case, this logic must be used in all those places around, having that
in util-linux would make it a bit more centric.

As an interface, I can imagine keeping the /dev/mapper as the primary
name and then have a brand new field like "preferred name" or so...
Just a suggestion.

-- 
Peter

  reply	other threads:[~2014-01-17  9:53 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-15  8:19 [linux-lvm] Identifying useable block devices Marius Vollmer
2014-01-15 15:49 ` Alasdair G Kergon
2014-01-15 16:17 ` Oliver Rath
2014-01-15 20:24   ` Anatoly Pugachev
2014-01-16  1:32     ` Paul B. Henson
2014-01-16  5:42       ` Peter Rajnoha
2014-01-16 21:03         ` Paul B. Henson
2014-01-17  7:54           ` Peter Rajnoha
2014-01-17  9:29             ` Karel Zak
2014-01-17  9:53               ` Peter Rajnoha [this message]
2014-01-16  6:04 ` Peter Rajnoha
2014-01-17 10:02 ` Marius Vollmer
2014-01-17 13:35   ` Marius Vollmer
2014-01-20 11:52     ` Peter Rajnoha
2014-01-20 11:49   ` Peter Rajnoha
2014-01-20 12:02     ` Peter Rajnoha
2014-01-22  9:23       ` Marius Vollmer
2014-01-23 11:42         ` Peter Rajnoha
2014-01-23 12:35           ` Marius Vollmer
2014-01-24 13:24             ` Peter Rajnoha
2014-01-24 13:29               ` Peter Rajnoha
2014-01-24 14:39                 ` Marius Vollmer
2014-01-24 15:02                   ` Peter Rajnoha
2014-01-27  7:37                     ` Marius Vollmer
2014-01-24 14:50               ` Marius Vollmer
2014-01-24 15:08                 ` Peter Rajnoha
2014-01-24 15:17                 ` Zdenek Kabelac
2014-01-24 15:20                   ` Peter Rajnoha
2014-01-22  9:02     ` Marius Vollmer

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=52D8FD9B.5060701@redhat.com \
    --to=prajnoha@redhat.com \
    --cc=henson@acm.org \
    --cc=kzak@redhat.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).