Found duplicate PV using /dev/sdaw not /dev/sda
Tras instalar device-mapper-multipathing en un Linux Red Hat, al hacer un vgdisplay obtenemos los siguientes errores:
[root@host ~]# vgdisplay -v /dev/vgarchive Using volume group(s) on command line Finding volume group "vgarchive" Found duplicate PV FovoFd029s4wTbhDI4eHb7AmwO5aDNHw: using /dev/sdaw not /dev/sda Found duplicate PV dfFrDD6GE8ffdROs9ppajQmnimk3z5Ft: using /dev/capi20 not /dev/sdq Found duplicate PV dxkfHlV0E1dVzZUfq2iraqN6SsXL8OKH: using /dev/sdcc not /dev/sdag Found duplicate PV pelZWFmdJdLXfEkJwxQuDL7odMRMc08v: using /dev/sdax not /dev/sdb Found duplicate PV W2JZ9xfiYiEJi62RLl2eI2WYuZU16j65: using /dev/sdbn not /dev/sdr Found duplicate PV rHerNtpZ1ToCg0ebmWFExjkgzcpjE2VE: using /dev/sdcd not /dev/sdah --- Volume group --- VG Name vgarchive System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 2 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size 20.00 GB PE Size 4.00 MB Total PE 5119 Alloc PE / Size 5119 / 20.00 GB Free PE / Size 0 / 0 VG UUID KLDU2E-Mela-LpcH-0pom-Rcao-jYiI-N9DgrU --- Logical volume --- LV Name /dev/vgarchive/lvolarchive VG Name vgarchive LV UUID qUuP60-LLbv-lZql-7c0a-pN7q-iOM5-ji1v5j LV Write Access read/write LV Status available # open 0 LV Size 20.00 GB Current LE 5119 Segments 1 Allocation inherit Read ahead sectors 0 Block device 253:33 --- Physical volumes --- PV Name /dev/mapper/mpath17 PV UUID YXUz0J-9NbL-BB3b-NnBm-JheM-Fcs1-DcJ98K PV Status allocatable Total PE / Free PE 5119 / 0
Esto se produce por que por defecto, lvm escanea todos los discos para buscar si contienen physical volumens por lo que para el sistema, está encontrado el mismo PV a través de varios caminos.
Si echamos un vistazo al fichero /etc/lvm/lvm.conf podemos ver lo siguiente:
# A filter that tells LVM2 to only use a restricted set of devices.
# The filter consists of an array of regular expressions. These
# expressions can be delimited by a character of your choice, and
# prefixed with either an ‘a’ (for accept) or ‘r’ (for reject).
# The first expression found to match a device name determines if
# the device will be accepted or rejected (ignored). Devices that
# don’t match any patterns are accepted.
Por lo que tenemos que añadir un filtro para que escanee los dispositivos multipath /dev/mpath/ que son los dispositivos virtuales que engloban todos los caminos hacia los discos e ignore el resto. En las opciones del filtro, con “a” indicamos que lo acepte y con “r” que lo rechace. El filtro a añadir quedaría de la siguiente manera:
filter = [ "a/dev/mpath/.*/", "r/.*/" ]
A continuación tan solo hacemos un vgscan y los warnings desaparecen. Tenemos que tener en cuenta si tenemos PVs en discos locales, como suele ser habitual para el VolGroup00, tenemos que especificar que escanee también los discos locales que están bajo /dev/cciss/ por lo que el filtro quedaría así:
filter = [ "a/dev/mpath/.*/","a/dev/cciss/.*/", "r/.*/" ]
Si esto no se hiciera, no veríamos el VolGroup00 lo que nos podría dar algún susto