Skip to contentSkip to conversation

unwanted autocreation of /dev/mapper/ entries while using parted on lvm devices

linux-lvm Oliver Rath 2 participants 5 messages Feb 23, 2014 – Feb 24, 2014

lore
Share & tools
lore
#0 lore raw

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:

root@dmicrash\:rules.d# vgcreate myvg /dev/sdc1 /dev/sdd1
  Volume group "myvg" successfully created
root@dmicrash\:rules.d# lvcreate --name test --size 20G myvg
  Logical volume "test" created
root@dmicrash\:rules.d# parted /dev/myvg/test mklabel msdos
root@dmicrash\:rules.d# parted /dev/myvg/test mkpart primary  0% 40%
root@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

#1 lore raw
Quoted 18 lines · 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 --enable-udev_rules. Here my testing results:

root@dmicrash\:rules.d# vgcreate myvg /dev/sdc1 /dev/sdd1
  Volume group "myvg" successfully created
root@dmicrash\:rules.d# lvcreate --name test --size 20G myvg
  Logical volume "test" created
root@dmicrash\:rules.d# parted /dev/myvg/test mklabel msdos
root@dmicrash\:rules.d# parted /dev/myvg/test mkpart primary  0% 40%
root@dmicrash\:rules.d# ls /dev/mapper/
control  myvg-test  myvg-test1
Quoted 7 lines

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.

Signature · 1 line
Peter
#2 lore raw

Hi Peter,

thanks for your reply!

Am 24.02.2014 09:41, schrieb Peter Rajnoha:

Quoted 10 lines · Oliver Rath
Quoted 1 line

[..]

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

#3 lore raw
In reply to Peter Rajnoha

Hi Peter!

Am 24.02.2014 09:41, schrieb Peter Rajnoha:

Quoted 6 lines · Oliver Rath

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

#4 lore raw
Quoted 10 lines · Oliver Rath

Hi Peter!

Am 24.02.2014 09:41, schrieb Peter Rajnoha:

Quoted 6 lines · Oliver Rath

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.

Quoted 4 lines

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...

Quoted 4 lines

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.

Signature · 1 line
Peter