Le problème
Lorsque vous essayez de créer un volume physique, vous obtenez l'erreur ci-dessous
erreur :
# pvcreate /dev/mappper/mpath25 Device /dev/mappper/mpath25 not found (or ignored by filtering).
Le problème peut être reproduit à volonté en procédant comme suit :
# pvcreate /dev/mappper/mpath25
La solution
Lors de la vérification, il a été constaté que le secteur de démarrage n'était pas remis à zéro.
# pvcreate /dev/mappper/mpath25 Device /dev/mappper/mpath25 not found (or ignored by filtering).
# fdisk -l /dev/mapper/mpath25 Disk /dev/mapper/mpath25 doesn't contain a valid partition table
Cela montre qu'il n'y avait aucune pratique présente sur le disque. Vous pouvez exécuter la commande pvcreate avec l'option détaillée "-vvv" pour obtenir plus de détails sur l'erreur :
# pvcreate -vvv /dev/mapper/mpath25 Processing: pvcreate -vvv /dev/mapper/mpath25 O_DIRECT will be used Setting global/locking_type to 1 Setting global/wait_for_locks to 1 File-based locking selected. Setting global/locking_dir to /var/lock/lvm metadata/pvmetadataignore not found in config: defaulting to n metadata/pvmetadatasize not found in config: defaulting to 255 metadata/pvmetadatacopies not found in config: defaulting to 1 Locking /var/lock/lvm/P_orphans WB _do_flock /var/lock/lvm/P_orphans:aux WB _do_flock /var/lock/lvm/P_orphans WB _undo_flock /var/lock/lvm/P_orphans:aux dm version OF [16384] dm status (253:11) OF [16384] /dev/mapper/mpath25: New preferred name ### indicates that it can find the device Opened /dev/mapper/mpath25 RO O_DIRECT /dev/mapper/mpath25: size is 629145600 sectors Closed /dev/mapper/mpath25 /dev/mapper/mpath25: size is 629145600 sectors Opened /dev/mapper/mpath25 RO O_DIRECT /dev/mapper/mpath25: block size is 4096 bytes Closed /dev/mapper/mpath25 Using /dev/mapper/mpath25 Opened /dev/mapper/mpath25 RO O_DIRECT /dev/mapper/mpath25: block size is 4096 bytes /dev/mapper/mpath25: No label detected Closed /dev/mapper/mpath25 dm status (253:11) OF [16384] Opened /dev/mapper/mpath25 RO O_DIRECT /dev/mapper/mpath25: size is 629145600 sectors Closed /dev/mapper/mpath25 /dev/mapper/mpath25: size is 629145600 sectors Opened /dev/mapper/mpath25 RO O_DIRECT /dev/mapper/mpath25: block size is 4096 bytes Closed /dev/mapper/mpath25 Using /dev/mapper/mpath25 Opened /dev/mapper/mpath25 RW O_EXCL O_DIRECT Closed /dev/mapper/mpath25 /dev/mapper/mpath25: size is 629145600 sectors Opened /dev/mapper/mpath25 RO O_DIRECT /dev/mapper/mpath25: block size is 4096 bytes Closed /dev/mapper/mpath25 /dev/mapper/mpath25: size is 629145600 sectors Opened /dev/mapper/mpath25 RO O_DIRECT /dev/mapper/mpath25: block size is 4096 bytes Closed /dev/mapper/mpath25 Opened /dev/mapper/mpath25 RO O_DIRECT /dev/mapper/mpath25: block size is 4096 bytes Closed /dev/mapper/mpath25 dm status (253:11) OF [16384] Opened /dev/mapper/mpath25 RO O_DIRECT /dev/mapper/mpath25: size is 629145600 sectors Closed /dev/mapper/mpath25 /dev/mapper/mpath25: size is 629145600 sectors Opened /dev/mapper/mpath25 RO O_DIRECT /dev/mapper/mpath25: block size is 4096 bytes Closed /dev/mapper/mpath25 Using /dev/mapper/mpath25 /dev/mapper/mpath25: size is 629145600 sectors Setting devices/data_alignment to 0 Setting devices/default_data_alignment to 0 /dev/mapper/mpath25: Setting PE alignment to 128 sectors. /dev/mapper/mpath25: Setting PE alignment offset to 0 sectors. Opened /dev/mapper/mpath25 RW O_DIRECT Wiping /dev/mapper/mpath25 at sector 8 length 8 sectors /dev/mapper/mpath25: block size is 4096 bytes Closed /dev/mapper/mpath25 Set up physical volume for "/dev/mapper/mpath25" with 629145600 available sectors Scanning for labels to wipe from /dev/mapper/mpath25 Opened /dev/mapper/mpath25 RW O_DIRECT /dev/mapper/mpath25: block size is 4096 bytes Closed /dev/mapper/mpath25 Zeroing start of device /dev/mapper/mpath25 Opened /dev/mapper/mpath25 RW O_DIRECT Wiping /dev/mapper/mpath25 at sector 0 length 4 sectors /dev/mapper/mpath25: block
Dernière entrée dans la sortie de débogage indiquant que la cause se trouve dans la zone du premier secteur de mise à zéro.
Pour mettre en œuvre la solution, veuillez exécuter les étapes suivantes :
1. Pour les périphériques de disque entiers, seule la table de partition doit être effacée, ce qui détruira effectivement toutes les données sur ce disque. Cela peut être fait en mettant à zéro le premier secteur avec :
# dd if=/dev/zero of=bs=512 count=1.
2. Exécutez pvcreate pour créer le volume physique :
# pvcreate [device]
3. Migrez la solution, le cas échéant, vers d'autres environnements.