LVM errors - Logical Volume Management (errors)

mail

pvcreate error : Device /dev/sdb excluded by a filter.

Situation

pvcreate /dev/sdb
Device /dev/sdb excluded by a filter.

Solution

Generic situation

  1. wipefs -a /dev/sdb
    /dev/sdb: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54
    /dev/sdb: 8 bytes were erased at offset 0x3a3817d5c00 (gpt): 45 46 49 20 50 41 52 54
    /dev/sdb: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa
    /dev/sdb: calling ioctl to re-read partition table: Success
  2. pvcreate /dev/sdb
    Physical volume "/dev/sdb" successfully created.

More complex situation : when the device was already set up as a LVM PV

  1. the wipefs command shown above fails :
    wipefs -a /dev/sdb
    wipefs: error: /dev/sdb: probing initialization failed: Device or resource busy
  2. just to see what we have :
    lsblk
    NAME		MAJ:MIN	RM	SIZE	RO	TYPE	MOUNTPOINT
    
    sdb		8:16	0	60G	0	disk
    ├─sdb1		8:17	0	20G	0	part
    │ └─myVG-myLV	253:2	0	60G	0	lvm
    └─sdb2		8:18	0	40G	0	part
      └─myVG-myLV	253:2	0	60G	0	lvm
    
  3. trying to force it :
    wipefs -af /dev/sdb
    /dev/sdb: 2 bytes were erased at offset 0x000001fe (dos): 55 aa
    /dev/sdb: calling ioclt to re-read partition table: Device or resource busy
  4. this article lists several possible causes, among which one did ring a bell : The device for pvcreate was previously an LVM PV, and there are still entries in the device-mapper table for this device. Let's try to know more :
    dmsetup info -c
    Name		Maj	Min	Stat	Open	Targ	Event	UUID
    
    myVG-myLV	253	2	L--w	0	2	0	LVM-fMb6Ufb0Pa3W129dkBZYmz4Czy1dAYAmJ8cYIlbDMV318FyMBD5HgBPGCfv7jHEC
    
  5. let's remove it :
    dmsetup remove myVG-myLV
    (nothing)
  6. check :
    dmsetup info -c
    Name	Maj	Min	Stat	Open	Targ	Event	UUID
    (lists other devices but myVG-myLV is gone)
  7. and finally :
    pvcreate /dev/sdb
    Physical volume "/dev/sdb" successfully created.