several error for pvcreate and lvcreate

I am getting the following error

pvcreate /dev/mapper/mpathd
  Error reading device /dev/mapper/mpathd at 0 length 512.
  Error reading device /dev/mapper/mpathd at 0 length 4.
  Error reading device /dev/mapper/mpathd at 4096 length 4.
  Error reading device /dev/mapper/mpathd at 0 length 512.
  Error reading device /dev/mapper/mpathd at 0 length 4.
  Error reading device /dev/mapper/mpathd at 4096 length 4.

what should I do to solve this ? how to find what is wrong ?

some info that could be useful

ls -l /dev/mapper/mpathb*
lrwxrwxrwx. 1 root root 7 Jun  3 06:03 /dev/mapper/mpathb -> ../dm-3

and also I added this in a filter (found here https://access.redhat.com/discussions/2423461)

/etc/lvm/lvm.conf file

filter = [ "a|/dev/sda|", "a|/dev/mapper/*|" , "r/block/", "r/disk/", "r/sd.*/", "a/.*/" ]

it did not work and I got the same error.

I also tried to fdisk it but I got this error

fdisk /dev/mapper/mpathd
fdisk: cannot open /dev/mapper/mpathd: Input/output error

Solution 1:

The entries in /dev/mapper are LVM logical volumes. That is not possible to create LVM volume on existing LVM volumes.

You can only use physical disks like /dev/sda or physical volumes, like /dev/sda1 to create LVM physical volume.

For example you have 2 disks /dev/sda and /dev/sdb, so the correct syntax:

To initialize disks as a Physical Volume

pvcreate /dev/sda
pvcreate /dev/sdb

Then you need to create a Volume Group named vg1 for example

vgcreate -s 32M vg1 /dev/sda /dev/sdb

Now you can create a 20GB Logical Volume lv1 from some of the free space in vg1

lvcreate -n lv1 -L 20G vg1

See more details at this page