From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from archlinux.org (gerolde.archlinux.org [66.211.214.132]) by mail.saout.de (Postfix) with ESMTP for ; Tue, 18 Jan 2011 17:37:38 +0100 (CET) Received: from [134.61.71.118] (71-118.eduroam.RWTH-Aachen.DE [134.61.71.118]) by archlinux.org (Postfix) with ESMTPSA id 9263890246 for ; Tue, 18 Jan 2011 11:31:23 -0500 (EST) Message-ID: <4D35C062.8050606@archlinux.org> Date: Tue, 18 Jan 2011 17:31:30 +0100 From: =?ISO-8859-15?Q?Thomas_B=E4chler?= MIME-Version: 1.0 References: <20110118090149.GE14608@jeru.org> <4D355EC0.6090402@redhat.com> <20110118142546.GA4056@tansi.org> In-Reply-To: <20110118142546.GA4056@tansi.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig8E65529E25D62565B5A408C7" Subject: Re: [dm-crypt] From /dev/mapper to the real device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: dm-crypt@saout.de This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig8E65529E25D62565B5A408C7 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Am 18.01.2011 15:25, schrieb Arno Wagner: >=20 >=20 > 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/= =2E..=20 >> so there are hardcoded priorities) >=20 > I have a Python script, that does a traversal of /dev/ > to find all devices mapped to the same object as a node=20 > 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=3D/dev/foo/bar --query=3Dsymlink udevadm info --name=3D/dev/foo/bar --query=3Dname 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. --------------enig8E65529E25D62565B5A408C7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEAREIAAYFAk01wGIACgkQEda5KzHP/VAXugCgthZRDA50TtCNNNlRE/9i1jtt YSwAoJV3sIOKgZuhyuaDGa4A+G394DBb =IUfv -----END PGP SIGNATURE----- --------------enig8E65529E25D62565B5A408C7--