Discussion:
[linux-lvm] unwanted autocreation of /dev/mapper/ entries while using parted on lvm devices
Oliver Rath
2014-02-23 22:36:28 UTC
Permalink
Hi List,

Im not sure, if the udev-rules of lvm is creating this. Im Using Ubuntu
12.04.4 + lvm git yesterday, compiles with --enable-udev_sync
--enable-udev_rules. Here my testing results:


***@dmicrash\:rules.d# vgcreate myvg /dev/sdc1 /dev/sdd1
Volume group "myvg" successfully created
***@dmicrash\:rules.d# lvcreate --name test --size 20G myvg
Logical volume "test" created
***@dmicrash\:rules.d# parted /dev/myvg/test mklabel msdos

***@dmicrash\:rules.d# parted /dev/myvg/test mkpart primary 0% 40%

***@dmicrash\:rules.d# ls /dev/mapper/
control myvg-test myvg-test1

The device myvg-test1 was created automatically (normally this is done
by kpartx?). I disabled gnome-automounter, didnt help.

I tried to monitor this with udevadm --monitor, but i didnt get
displayed the rule-file who did this.

Any hints?

Tfh!
Oliver
Peter Rajnoha
2014-02-24 08:41:03 UTC
Permalink
Post by Oliver Rath
Hi List,
Im not sure, if the udev-rules of lvm is creating this. Im Using Ubuntu
12.04.4 + lvm git yesterday, compiles with --enable-udev_sync
Volume group "myvg" successfully created
Logical volume "test" created
control myvg-test myvg-test1
The device myvg-test1 was created automatically (normally this is done
by kpartx?). I disabled gnome-automounter, didnt help.
I tried to monitor this with udevadm --monitor, but i didnt get
displayed the rule-file who did this.
Any hints?
The parted itself creates a new device-mapper mapping that represents
the partition. Then it's like any other device-mapper device and so
the /dev content is created by 10-dm-disk.rules (the /dev/mapper
content) and 13-dm-disk.rules (the /dev/disk content).

Parted has this functionality integrated so there's no need to call
kpartx in addition.
--
Peter
Oliver Rath
2014-02-24 12:17:39 UTC
Permalink
Hi Peter,

thanks for your reply!
Post by Peter Rajnoha
[..]
The parted itself creates a new device-mapper mapping that represents
the partition. Then it's like any other device-mapper device and so
the /dev content is created by 10-dm-disk.rules (the /dev/mapper
content) and 13-dm-disk.rules (the /dev/disk content).
Parted has this functionality integrated so there's no need to call
kpartx in addition.
Ist it possible to avoid this /dev/mapper-generation, if I partitioning
lvm-devices? My problem ist, that Im not able to export the whole device
i.e. as iscsi, if some sub-device is mapped in /dev/mapper/... (says,
its busy then ..).

At the moment I always have to delete these subdevices via kpartx -d
/dev/myvg/.. (or dmsetup remove ..) before exporting it, which is a bit
annoying.

I took a look into 10-dm.rules, but have no idea, what to do.

Regards,
Oliver
Oliver Rath
2014-02-24 12:40:06 UTC
Permalink
Hi Peter!
Post by Peter Rajnoha
The parted itself creates a new device-mapper mapping that represents
the partition. Then it's like any other device-mapper device and so
the /dev content is created by 10-dm-disk.rules (the /dev/mapper
content) and 13-dm-disk.rules (the /dev/disk content). Parted has this
functionality integrated so there's no need to call kpartx in addition.
On my machine parted-2.3 was running. Upgrading to parted-3.1 didnt
help, BUT building parted-3.1 for myself with ./configure
--disable-device-mapper works! Then parted does his job without creating
these deices implicitly.

Maybe you know a less radical method? I.e. I could exclude some names in
lvm.conf or something like this? The names of the lvm whould should
create subvolumes are well defined.

Regards,
Oliver
Peter Rajnoha
2014-02-24 13:09:27 UTC
Permalink
Post by Oliver Rath
Hi Peter!
Post by Peter Rajnoha
The parted itself creates a new device-mapper mapping that represents
the partition. Then it's like any other device-mapper device and so
the /dev content is created by 10-dm-disk.rules (the /dev/mapper
content) and 13-dm-disk.rules (the /dev/disk content). Parted has this
functionality integrated so there's no need to call kpartx in addition.
On my machine parted-2.3 was running. Upgrading to parted-3.1 didnt
help, BUT building parted-3.1 for myself with ./configure
--disable-device-mapper works! Then parted does his job without creating
these deices implicitly.
Yes, I was just about to write that :) I think there's no option in parted
to avoid creating these mappings for partitions once the parted is
compiled with device-mapper support. So yes, the only option is either
to recompile without devmapper support or always remove these mappings
manually...
Post by Oliver Rath
Maybe you know a less radical method? I.e. I could exclude some names in
lvm.conf or something like this? The names of the lvm whould should
create subvolumes are well defined.
You would need to tell parted to stop syncing the state after partition
signatures are created/removed on/from disk. But parted always creates/removes
the partition mappings unconditionally (...or it calls BLKRRPART/blkpg for
non-dm devices).

You can try using fdisk instead which does not do this step and requires
calling partprobe or kpartx manually after partitioning.
--
Peter
Loading...