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:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ dm-crypt mailing list dm-crypt@xxxxxxxx http://www.saout.de/mailman/listinfo/dm-crypt