Il problema
Quando si tenta di creare un volume fisico , viene visualizzato il seguente errore
errore:
# pvcreate /dev/mappper/mpath25 Device /dev/mappper/mpath25 not found (or ignored by filtering).
Il problema può essere riprodotto a piacimento con il seguente passaggio:
# pvcreate /dev/mappper/mpath25
La soluzione
Dopo il controllo è stato riscontrato che il settore iniziale non è stato azzerato.
# 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
Questo mostra che non c'era alcuna pratition presente sul disco. Puoi eseguire il comando pvcreate con l'opzione dettagliata "-vvv" per ottenere maggiori dettagli sull'errore:
# 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
Ultima voce nell'output di debug che indica che la causa è nell'area del primo settore di azzeramento.
Per implementare la soluzione, eseguire i seguenti passaggi:
1. Per gli interi dispositivi del disco deve essere cancellata solo la tabella delle partizioni, che distruggerà effettivamente tutti i dati su quel disco. Questo può essere fatto azzerando il primo settore con:
# dd if=/dev/zero of=bs=512 count=1.
2. Eseguire pvcreate per creare il volume fisico:
# pvcreate [device]
3. Migrare la soluzione in modo appropriato ad altri ambienti.