pvcreate: device /dev/sdXX not found (or ignored by filtering)

I'm unable to add a new volume (provisioned by a SAN storage) as a PhysicalVolume for the host's LVM volume. Here is the error message:

#sudo pvcreate /dev/sdc1 -v
  Device /dev/sdc1 not found (or ignored by filtering).

OS: Ubuntu 14.04.2 LTS (GNU/Linux 3.16.0-30-generic x86_64)

fdisk:

#sudo fdisk /dev/sdc -l

Disk /dev/sdc: 2198.0 GB, 2197999845376 bytes
237 heads, 20 sectors/track, 905689 cylinders, total 4292968448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 1048576 bytes
Disk identifier: 0x00031fdb

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048  4292968447  2146483200   8e  Linux LVM

parted:

#sudo parted /dev/sdc
GNU Parted 2.3
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: HP MSA 2040 SAN (scsi)
Disk /dev/sdc: 2198GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  2198GB  2198GB  primary               lvm

filter (only uncommented lines):

filter = [ "a/.*/" ]
global_filter = [ "a|loop0|", "a|loop1|", "a|sda5|", "r|.*|" ]

partprobe:

sudo partprobe -s
/dev/sda: msdos partitions 1 2 <5>
/dev/sdb: msdos partitions 1 2
/dev/sdc: msdos partitions 1
/dev/sdd: msdos partitions 1
/dev/mapper/devstack--vg-swap_1: loop partitions 1
/dev/mapper/devstack--vg-root: loop partitions 1

What I've tried so far:

  • fdisk /dev/sdc n, p, 1, ENTER 2 times, t, 8e, w
  • (parted) mklabel msdos
  • (parted) mklabel gpt
  • (parted) mklabel loop
  • zero filled the first sector of /dev/sdc
  • zero filled /dev/sdc
  • partprobe
  • partprobe /dev/sdc
  • reboot

Solution 1:

The problem is with the global_filter setting in etc/lvm/lvm.conf that was generated by the Devstack installation.

I commented the line out and am now able to use pvcreate normally.

 #global_filter = [ "a|loop0|", "a|loop1|", "a|sda5|", "r|.*|" ]  # from devstack

Thanks to @MichaelHampton for pointing out.

Solution 2:

Rather than commenting out the entire line, it is possible to add the disk partitions you want to add - in my case, I also wanted to add /dev/sdc1, so changed the line to the following:

global_filter = [ "a|loop0|", "a|loop1|", "a|sda5|", "a|sdb5|", "a|sdc1|", "r|.*|" ]  # from devstack

After that, the pvcreate command worked fine. No reboot required.

Thanks for the original post and answers, though - without that information I would still be trying to figure out what was going on.

Solution 3:

I had a similar problem on Debian 8

> lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 8.7 (jessie)
Release:        8.7
Codename:       jessie

> vgextend vg_data /dev/sdc
  Device /dev/sdc not found (or ignored by filtering).
  Unable to add physical volume '/dev/sdc' to volume group 'vg_data'.

Difference to the Opening Post was that my global_filter was commented out on default with no content inside so I left it as is.

# global_filter = []

There are 3 volume groups on this system, 2 created with the installation. vg_data was created afterwards from sdd (same Controller as sdc below) with no errors and entire disk as RAW.

I finally went with the following steps:

> parted /dev/sdc
GNU Parted 3.2
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) mklabel gpt
Warning: The existing disk label on /dev/sdc will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes

(parted) mkpart primary ext4 1049kB 6000GB
(parted) p
Model: AMCC 9650SE-12M DISK (scsi)
Disk /dev/sdc: 6000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  6000GB  6000GB  ext4         primary

(parted) quit
Information: You may need to update /etc/fstab.

> partprobe /dev/sdc
> partprobe /dev/sdc1

I had hoped that lvm would overwrite the partition and use the disk as RAW but...

> vgextend vg_data /dev/sdc
  Device /dev/sdc not found (or ignored by filtering).
  Unable to add physical volume '/dev/sdc' to volume group 'vg_data'.

So in the end I used the partition and ...

> vgextend vg_data /dev/sdc1
  Physical volume "/dev/sdc1" successfully created
  Volume group "vg_data" successfully extended

yay vg_data was finally extended