All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Rajnoha <prajnoha@redhat.com>
To: LVM general discussion and development <linux-lvm@redhat.com>
Subject: Re: [linux-lvm] /dev/dm-* or /dev/mapper/*
Date: Mon, 17 Aug 2009 10:48:46 +0200	[thread overview]
Message-ID: <4A89196E.6020509@redhat.com> (raw)
In-Reply-To: <1250467733.18434.1330126635@webmail.messagingengine.com>

On 08/17/2009 02:08 AM, Edward Siefker wrote:
> I originally set up raid-luks-lvm on this machine with debian's
> installer tool, now I am trying to add another encrypted raid1 device to
> the existing volume group.  I already have the raid device set up and
> encrypted, that's no problem.  Now the linux gazette
> (http://linuxgazette.net/140/pfeiffer.html) tells me I should run
> 'pvcreate' on the device in /dev/mapper.  However, if I examine my
> existing physical volumes with 'pvscan' I get the following:
> 
> iblis:/home/hatta# pvscan
>   PV /dev/dm-0   VG iblis-volumes   lvm2 [931.32 GB / 0    free]
>   Total: 1 [931.32 GB] / in use: 1 [931.32 GB] / in no VG: 0 [0   ]

Which version of libdevmapper/dmsetup do you use?

> Apparently I am using /dev/dm-0 instead of /dev/mapper/md1_crypt. I
> wondered if these were maybe two names for the same thing, so I checked
> ls:
> 
> iblis:/home/hatta# ls -ld /dev/dm-0 /dev/mapper/md1_crypt
> brw-rw---- 1 root disk 253, 0 2009-08-16 12:02 /dev/dm-0
> brw-rw---- 1 root disk 253, 0 2009-08-16 12:02 /dev/mapper/md1_crypt
> 
> Same major and minor number, if that means anything.

Well, from functional point of view they are same - they point to the
same device, of course. But dmsetup/lvm itself does not create the
/dev/dm-X nodes - the ones in /dev/mapper are the right and official
ones that should always be used.

The /dev/dm-X nodes are created by some general udev rules, dm-X is
only internal kernel name for that device and you can't rely on those
names (because the number X that is assigned is not stable and could
be changed - it depends on the sequence of device activation).

> iblis:/home/hatta# dmsetup info /dev/dm-0
> Device /dev/dm-0 not found
> Command failed

..just forget that /dev/dm-X exists :) The thing is that these nodes
shouldn't be there with recent versions of libdevmapper/dmsetup used
in all distros..


HOWEVER, there has been some work done on udev support in LVM upstream
lately (version 2.02.51, which also includes dmsetup/libdevmapper).
Also, new udev rules have been added to support device mapper devices.
When this udev support is enabled (it's still disabled by default
though), the /dev/dm-X nodes are created directly by device-mapper
rules, then /dev/mapper/ symlinks that point to /dev/dm-X
(and /dev/<vgname>/<lvname> symlinks that point to /dev/dm-X
as well for LVM devices). The reason for doing so is that creating
nodes root /dev directory is considered to be the "standard way".
Nevertheless, you should always use /dev/mapper!

> iblis:/home/hatta# dmsetup info /dev/mapper/md1_crypt 
> Name:              md1_crypt
> State:             ACTIVE
> Read Ahead:        256
> Tables present:    LIVE
> Open count:        7
> Event number:      0
> Major, minor:      253, 0
> Number of targets: 1
> 
> 
> It works on one, and not the other.  So they're not the same thing.  My
> new device 'md2_crypt' corresponds to /dev/dm-8, if I am to trust the
> major/minor numbers. Should I run pvcreate on /dev/dm-8 or
> /dev/mapper/md2_crypt?

Alays use /dev/mapper. This is the only reliable way :)

Peter

  parent reply	other threads:[~2009-08-17  8:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-17  0:08 [linux-lvm] /dev/dm-* or /dev/mapper/* Edward Siefker
2009-08-17  1:30 ` Ron Johnson
2009-08-17  8:48 ` Peter Rajnoha [this message]
2009-08-17  9:01 ` Peter Rajnoha

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=4A89196E.6020509@redhat.com \
    --to=prajnoha@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.