pvcreate command fails while using multipath device with below error even when the device is present.
# fdisk -l /dev/mapper/mpatha Disk /dev/mapper/mpatha: 51.6 GB, 51624542208 bytes, 100829184 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x5d7fc634 Device Boot Start End Blocks Id System /dev/mapper/mpatha1 32 100829183 50414576 83 Linux
# pvcreate /dev/mapper/mpatha Device /dev/mapper/mpatha not found (or ignored by filtering).
The error usually occurs either when/etc/lvm/lvm.conf
has wrong filter section or the device which is trying to be used as a PV already has an underlying Partition. Use either of the solutions described below depending on the situation you have.
Solution 1 : Verify filter settings in /etc/lvm/lvm.conf
1. Verify filter settings in /etc/lvm/lvm.conf
and ensure it allows to scan multipath devices. A system with LVM devices on local SCSI storage and device-mapper-multipath SAN storage might define:
# cat /etc/lvm/lvm.conf filter = [ "a|^/dev/sda[1-9]$|", "a|^/dev/mapper/*|", "r|^/dev/*|" ]
2. Use the multipath device /dev/mapper/mpatha and pvcreate on a multipath device.
# pvcreate /dev/mapper/mpatha Physical volume "/dev/mapper/mpatha" successfully created
Solution 2: delete existing partitions if any
A second solution is to actually verify if the device which is trying to be used as a PV does not hold any underlying partitions. In the below case, the multipath disk mpatha has a partition mpatha1 as shown below.
# fdisk -l /dev/mapper/mpatha Disk /dev/mapper/mpatha: 51.6 GB, 51624542208 bytes, 100829184 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x5d7fc634 Device Boot Start End Blocks Id System /dev/mapper/mpatha1 32 100829183 50414576 83 Linux
NOTE:
If you attempt to create an LVM physical volume on a whole device on which you have configured partitions, the pvcreate command will fail. If you wish to use the whole device rather than a partition, you must remove the existing partitions from the device. You can remove existing partitions with the kpartx -d and the fdisk commands. If your system has block devices that are greater than 2Tb, you can use the parted command to remove partitions.
As described please delete any underlying partition on a device which is trying to be as a PV by issuing fdisk command afterwards please re-try pvcreate.
# fdisk /dev/mapper/mpatha Disk /dev/mapper/mpatha: 51.6 GB, 51624542208 bytes, 100829184 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x5d7fc634 Device Boot Start End Blocks Id System /dev/mapper/mpatha1 32 100829183 50414576 83 Linux Command (m for help): d Partition number (1-4): 1 Command (m for help): w
# pvcreate /dev/mapper/mpatha Physical volume "/dev/mapper/mpatha" successfully created