10

I am trying to add a physical volume for use to add volume groups and thus LV inside them. Sadly I am getting the following error.

[root@server ~]# pvcreate /dev/sdb1
Device /dev/sdb1 not found (or ignored by filtering).

[root@server ~]# fdisk -l /dev/sdb

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdb: 19966.2 GB, 19966213488640 bytes
255 heads, 63 sectors/track, 2427420 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      267350  2147483647+  ee  GPT

I would appreciate any help you could give. This would be my first time having to add a pv and when researching the issue I didn't come across anything that was of much help.

OS is centos 6 - 64bit

Filters

# By default we accept every block device:
filter = [ "a/.*/" ]

# Exclude the cdrom drive
# filter = [ "r|/dev/cdrom|" ]

# When testing I like to work with just loopback devices:
# filter = [ "a/loop/", "r/.*/" ]

# Or maybe all loops and ide drives except hdc:
# filter =[ "a|loop|", "r|/dev/hdc|", "a|/dev/ide|", "r|.*|" ]

# Use anchors if you want to be really specific
# filter = [ "a|^/dev/hda8$|", "r/.*/" ]

Parted:

parted /dev/sdb "unit s" "print"
Model: Adaptec AdaptecRAID5 (scsi)
Disk /dev/sdb: 38996510720s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
4

5 Answers 5

7

The partition type in the MBR is set to "ee" meaning that there should be a GPT partition table on the disk, but as parted shows, there isn't a GPT table at all.

You need to either:
a) use parted to make a GPT partition, and use that partition as the PV
b) remove the partition table from the MBR altogether and just use block device /dev/sdb as the PV

3
  • I used parted to make a GPT partition. I then went to format it : mkfs.ext4 /dev/sdb1 mke2fs 1.41.12 (17-May-2010) mkfs.ext4: Size of device /dev/sdb1 too big to be expressed in 32 bits using a blocksize of 4096. Aug 2, 2013 at 22:17
  • @awmusic12635 you won't format this partition, you'll use pvcreate to turn it into a physical volume, lvcreate to create logical volume(s) from it and then you'll format the logical volumes with a filesystem.
    – DerfK
    Aug 2, 2013 at 23:02
  • You're using EL6. The maximum possible ext4 filesystem size is restricted to 16Tb because EL6 mkfs does not know about the 64bit filesystem flag. If you had EL7, you could make a 19Tb ext4 filesystem. Either use another filesystem like XFS, or do what @DerfK said and make smaller LVM Logical Volumes.
    – suprjami
    Oct 4, 2014 at 5:09
4

I found that I either needed to reboot the server or run 'partprobe /dev/sdaX' in order for pvcreate to be properly informed of the partition.

Also, fdisk is not lvm aware so it was handing out errors about partitions making me think there was a bigger problem when that was simply not the case.

4

Please run the below command before pvcreate

partprobe
partprobe /dev/sdb

Then run your command

pvcreate /dev/sdb1

Note : Sometimes you need to update your kernel manually. Thats why the above command required.

3

The block device type could also be a problem. If you run pvcreate with -vvvv and you see an error like "Skipping: Unrecognised LVM device type 251", then you have to add the magic number to the allowed devices list.

Just look up the device type for the number in /proc/devices and add it to the devices section of the lvm config /etc/lvm/lvm.conf, for example:

types = [ "bcache", 251 ]

That's it, you can now use pvcreate as expected.

2
  • The -vvvv helped me to find out that in the script, where pvcreate was immediately following parted /dev/nvme0n1 set 1 lvm on there is a short, but notable moment while device /dev/nvme0n1p1 is recreated by udev. So, pvcreate really couldn't find it, filing with the given error, while issuing the same command in a shell finished successfully. Jul 7, 2016 at 18:57
  • @TimurBakeyev okay, THAT is a good catch ;-)
    – Phillipp
    Jul 7, 2016 at 22:34
2

Your parted output shows that you don't have any partitions, thus /dev/sdb1 doesn't exist. You need to create the partition first.

1
  • Odd, It seems fdisk and parted gave different outputs. Thanks Aug 2, 2013 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.