From: "Thomas Bächler" <thomas@archlinux.org>
To: dm-crypt@saout.de
Subject: Re: [dm-crypt] From /dev/mapper to the real device
Date: Tue, 18 Jan 2011 17:31:30 +0100 [thread overview]
Message-ID: <4D35C062.8050606@archlinux.org> (raw)
In-Reply-To: <20110118142546.GA4056@tansi.org>
[-- Attachment #1: Type: text/plain, Size: 1569 bytes --]
Am 18.01.2011 15:25, schrieb Arno Wagner:
>
>
> On Tue, Jan 18, 2011 at 10:34:56AM +0100, Milan Broz wrote:
>> On 01/18/2011 10:01 AM, Xavier Nicollet wrote:
>>> I did something like that:
>>> cryptsetup luksOpen /dev/mapper/lv_device crypto_device
>>>
>>> I would like to find a way, given /dev/mapper/crypto_device, to find
>>> which lv_device it was built from.
>>
>> cryptsetup status crypto_device (for active mapping)?
>>
>> (But note this device name is not always the same you used, for LV you can
>> have several symlinks /dev/mapper/vg-lv or /dev/vg/lv or /dev/by-uuid/...
>> so there are hardcoded priorities)
>
> I have a Python script, that does a traversal of /dev/
> to find all devices mapped to the same object as a node
> in /dev/mapper/ for each node in /dev/mapper/. This works
> by comparing not names, but major and minor device number.
> It does not work for symlinks though, only for duplicate
> device special files. Symliks could be added easily though.
I don't see why this is necessary. I always have only one copy of the
device (/dev/dm-X) and a bunch of symlinks. The same is true for any
other device, not only device-mapper nodes. Any symlinks and the real
device node can be found using:
udevadm info --name=/dev/foo/bar --query=symlink
udevadm info --name=/dev/foo/bar --query=name
You can filter that output for whatever you need.
This is only screwed up if you don't let udev manage your devices and
mess with them yourself. cryptsetup doesn't do that, neither does the
device-mapper.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2011-01-18 16:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-18 9:01 [dm-crypt] From /dev/mapper to the real device Xavier Nicollet
2011-01-18 9:34 ` Milan Broz
2011-01-18 14:25 ` Arno Wagner
2011-01-18 16:31 ` Thomas Bächler [this message]
2011-01-18 15:38 ` [dm-crypt] Another corrupt luks header thread Viktor Ekmark
2011-01-18 16:36 ` Thomas Bächler
2011-01-18 18:54 ` Arno Wagner
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=4D35C062.8050606@archlinux.org \
--to=thomas@archlinux.org \
--cc=dm-crypt@saout.de \
/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