[linux-lvm] Identifying useable block devices

Peter Rajnoha prajnoha at redhat.com
Thu Jan 16 05:42:39 UTC 2014


On 01/16/2014 02:32 AM, Paul B. Henson wrote:
>> Anatoly Pugachev
>> Sent: Wednesday, January 15, 2014 12:25 PM
>>
>>> the /dev/mapper/.. devices are for internal use only.
>>
>> If so, how come most commands use it (df, mount, findmnt, etc..) and
>> not /dev/vg/vol notation?
> 
> Because /dev/vg/vol is just a symlink to /dev/mapper/vg-vol, and mount
> dereferences it and uses the authoritative name when it actually mounts it.

This applies only if the symlinks/nodes are created directly with
libdevmapper - which is the old classical way. If udev is used to manage /dev
content for dm/lvm devices then the /dev/vg/vol is a symlink to /dev/dm-X
(also /dev/mapper/vg-vol is a symlink to /dev/dm-X). And dm-X is not a
stable name - it can be different across reboots and activation/deactivation
cycle (hence it's never used in scripts etc.). So you have to be very careful
when dereferencing symlinks.

As for mount, findmnt and other utilities from util-linux - they all use
one common code which can handle this situation (e.g. if you call
"findmnt /dev/vg/vol", it shows you /dev/mapper/vg-vol on output, not
the dm-X the /dev/vg/vol is referencing actually).
-- 
Peter




More information about the linux-lvm mailing list