# LVM errors "Found duplicate PV"

## gcasillo

I recently did something that prevented my desktop from booting. The LVM partitions were not being recognized. After some Googling and legwork restoring the LVM partitions, I am now getting warnings/errors when booting and shutting down that read something like "Found duplicate PV" with a long, unique ID. Check out the output from pvdisplay:

```
Found duplicate PV iU3uWsnnNJZd4Yle7Z0Pl3tE0PJkdwN9: using /dev/sdb4 not /dev/sda4

  --- Physical volume ---

  PV Name               /dev/sdb4

  VG Name               vg

  PV Size               149.75 GB / not usable 0

  Allocatable           yes

  PE Size (KByte)       4096

  Total PE              38336

  Free PE               10944

  Allocated PE          27392

  PV UUID               iU3uWs-nnNJ-Zd4Y-le7Z-0Pl3-tE0P-JkdwN9
```

I would like to get rid of these warnings/errors though they appear to be harmless, and my desktop is running normally again. For reference, here is the output from my /etc/lvm/.cache:

```
# This file is automatically maintained by lvm.

persistent_filter_cache {

  valid_devices=[

    "/dev/md/0",

    "/dev/md/1",

    "/dev/disk/by-uuid/f4844d30-c6a5-492d-b75a-37c0976494e3",

    "/dev/disk/by-path/pci-0000:00:1f.2-scsi-1:0:0:0-part4",

    "/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0-part4",

    "/dev/disk/by-id/scsi-SATA_Maxtor_6Y160M0_Y424S2ME-part4",

    "/dev/disk/by-id/scsi-SATA_Maxtor_6Y160M0_Y42745BE-part4",

    "/dev/md/2",

    "/dev/disk/by-uuid/ef0f2a11-9758-477e-b750-8a2b753d679c",

    "/dev/md2",

    "/dev/md0",

    "/dev/md1",

    "/dev/sda4",

    "/dev/sdb4"

  ]

}
```

Thanks!

----------

## gcasillo

Anyone know how I can get rid of these errors?

----------

## erikm

Sounds like you initially set up /dev/sda4 as your PV, then rebooted or did something to change the drive assignment, and reactivated your volume groups on the 'new' block device, /dev/sdb4. If this is indeed correct, and you don't have a /dev/sda4 device node, a

```
~# pvremove /dev/sda4
```

 followed by 

```
~# vgreduce --removemissing <whatever volume group you had defined on this PV>
```

 should suffice.

----------

## nixnut

Moved from Installing Gentoo to Kernel & Hardware.

----------

## gcasillo

Thanks, ErikM. Here's my current drive letters:

```
poe gregg # ls /dev/sd*

/dev/sda  /dev/sda1  /dev/sda2  /dev/sda3  /dev/sda4  /dev/sdb  /dev/sdb1  /dev/sdb2  /dev/sdb3  /dev/sdb4
```

Two SATA drives configured in a RAID1 array:

/etc/mdadm.conf

```
ARRAY /dev/md0 devices=/dev/sda1,/dev/sdb1

ARRAY /dev/md1 devices=/dev/sda2,/dev/sdb2

ARRAY /dev/md2 devices=/dev/sda3,/dev/sdb3

ARRAY /dev/md3 devices=/dev/sda4,/dev/sdb4
```

I believe when I booted using a livecd, another external device, a USB drive, was detected first and assigned /dev/sda, and my internal SATA drives were assigned /dev/sdb and /dev/sdc respectively. Then I tried to recreate the physical volume using those drive letters. That's probably why I'm getting the "Found duplicate PV" errors.

So, don't I want to pvremove /dev/sdb4 instead of /dev/sda4?

----------

## erikm

Now I'm confused: I've never used software RAID. Shouldn't your PV be on the device nodes provided by the RAID driver, e.g. /dev/md[0-9]? If not, you can always include more than one physical device in your PV. This by default stripes your data on different devices, similar to RAID0.

Anyway, if you indeed intended to put the PV on sda4, then by all means, remove sdb4. Just, as always when messing with anything file system related, backup your data first.   :Wink: 

----------

## gcasillo

Indeed, I believe the PV should be on /dev/md3. I remember following this wiki during my installation. I did that installation over a year ago too.

FWIW, here's the output of pvdisplay, vgdisplay, and lvdisplay respectively:

```
  Found duplicate PV iU3uWsnnNJZd4Yle7Z0Pl3tE0PJkdwN9: using /dev/sdb4 not /dev/sda4

  --- Physical volume ---

  PV Name               /dev/sdb4

  VG Name               vg

  PV Size               149.75 GB / not usable 0

  Allocatable           yes

  PE Size (KByte)       4096

  Total PE              38336

  Free PE               10944

  Allocated PE          27392

  PV UUID               iU3uWs-nnNJ-Zd4Y-le7Z-0Pl3-tE0P-JkdwN9
```

```
  Found duplicate PV iU3uWsnnNJZd4Yle7Z0Pl3tE0PJkdwN9: using /dev/sdb4 not /dev/sda4

  --- Volume group ---

  VG Name               vg

  System ID

  Format                lvm2

  Metadata Areas        1

  Metadata Sequence No  7

  VG Access             read/write

  VG Status             resizable

  MAX LV                255

  Cur LV                5

  Open LV               5

  Max PV                255

  Cur PV                1

  Act PV                1

  VG Size               149.75 GB

  PE Size               4.00 MB

  Total PE              38336

  Alloc PE / Size       27392 / 107.00 GB

  Free  PE / Size       10944 / 42.75 GB

  VG UUID               w8Kk5i-mdgm-rFjG-0JQ4-VEE8-t045-v8v2a7
```

```
  Found duplicate PV iU3uWsnnNJZd4Yle7Z0Pl3tE0PJkdwN9: using /dev/sdb4 not /dev/sda4

  --- Logical volume ---

  LV Name                /dev/vg/usr

  VG Name                vg

  LV UUID                bRvrL0-pQ0C-ELXl-1Lv6-xUhE-sJBg-KJXAH4

  LV Write Access        read/write

  LV Status              available

  # open                 1

  LV Size                10.00 GB

  Current LE             2560

  Segments               1

  Allocation             inherit

  Read ahead sectors     0

  Block device           253:0

  --- Logical volume ---

  LV Name                /dev/vg/home

  VG Name                vg

  LV UUID                M3j3ya-VRyC-tCF4-yeTr-Wzmm-TO0V-p8y30p

  LV Write Access        read/write

  LV Status              available

  # open                 1

  LV Size                80.00 GB

  Current LE             20480

  Segments               1

  Allocation             inherit

  Read ahead sectors     0

  Block device           253:1

  --- Logical volume ---

  LV Name                /dev/vg/opt

  VG Name                vg

  LV UUID                Py9nPP-TFlE-2wpy-ME3X-lf3A-QJZW-MpZhll

  LV Write Access        read/write

  LV Status              available

  # open                 1

  LV Size                5.00 GB

  Current LE             1280

  Segments               1

  Allocation             inherit

  Read ahead sectors     0

  Block device           253:2

  --- Logical volume ---

  LV Name                /dev/vg/var

  VG Name                vg

  LV UUID                2QehQP-t2Io-kZqi-6vRI-x2q1-IKVY-toL7rp

  LV Write Access        read/write

  LV Status              available

  # open                 1

  LV Size                10.00 GB

  Current LE             2560

  Segments               1

  Allocation             inherit

  Read ahead sectors     0

  Block device           253:3

  --- Logical volume ---

  LV Name                /dev/vg/tmp

  VG Name                vg

  LV UUID                Wo2tfs-Yamm-bHkv-3fH7-e6Xf-bsxC-YM7PnU

  LV Write Access        read/write

  LV Status              available

  # open                 1

  LV Size                2.00 GB

  Current LE             512

  Segments               1

  Allocation             inherit

  Read ahead sectors     0

  Block device           253:4
```

----------

