[dm-crypt] u?mount (8) helper script for luks encrypted disks

Milan Broz gmazyland at gmail.com
Fri Aug 30 08:23:19 CEST 2013


On 30.8.2013 7:58, .. ink .. wrote:
>
>     On 30.8.2013 1:56, .. ink .. wrote:
>
>         On unmounting.
>         1. Look at the path to be unmounted,if it starts with "/dev/mapper/"
>         then it could an mdraid path or a cryptsetup mapper path or
>         something else.Its easy to check which one is it.
>
>
>     Nope.
>
>     You have /dev/VG/LV or /dev/mpath/NAME (aka friendly mpath names) etc.
>     These are symlinks, or on non-udev system directly device nodes.
>
>     If you want to check for dm device, you should check for major
>     number of device. Ditto for MD (note md can be some fake
>     raid as well as replacement for dmraid.)
>
>
> checking for major:minor number does not work on devices with btrfs[1]

Yes. But I thought you want to check if underlying device is DM device,
then major is DM major number always.

>
> What i do in my project to identify lvm path is to check if the path exists in both "/dev/abc/def" and "/dev/mapper/abd-def".formats.

That will _usually_ work but the cost of duplicating lvm/mpath naming
logic in your program (I think multipath has this configurable also).

>
> mdraid paths are usually in "/dev/mdX" or "/dev/md/X" format.

Yes. But once this will change, you will have to update all programs
which have this logic hardcoded.


But again, it it works for you, that's fine but maintaining
such script upstream means thinking about generic solution.

> [1] http://article.gmane.org/gmane.comp.file-systems.btrfs/2851

Yes, I know about it, util-linux maintainer complained several times about
it as well.

Milan


More information about the dm-crypt mailing list