GNU/Linux >> Tutoriales Linux >  >> Cent OS

“Dispositivo /dev/mappper/mpath25 no encontrado (o ignorado por el filtrado)”:error al crear un volumen físico con pvcreate

El problema

Al intentar crear un volumen físico, aparece el siguiente error

error:

# pvcreate /dev/mappper/mpath25
Device /dev/mappper/mpath25 not found (or ignored by filtering).

El problema se puede reproducir a voluntad con el siguiente paso:

# pvcreate /dev/mappper/mpath25

La solución

Al verificar, se encontró que el sector de inicio no se puso a cero.

# 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

Esto muestra que no había ninguna práctica presente en el disco. Puede ejecutar el comando pvcreate con la opción detallada "-vvv" para obtener más detalles sobre el error:

# 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

Última entrada en la salida de depuración que indica que la causa está en el área del primer sector de puesta a cero.

Para implementar la solución, ejecute los siguientes pasos:

1. Para dispositivos de disco completo, solo se debe borrar la tabla de particiones, lo que destruirá efectivamente todos los datos en ese disco. Esto se puede hacer poniendo a cero el primer sector con:

# dd if=/dev/zero of= bs=512 count=1.

2. Ejecute pvcreate para crear el volumen físico:

# pvcreate [device]

3. Migre la solución según corresponda a otros entornos.


Cent OS
  1. Linux:¿Diferencia entre /dev/console, /dev/tty y /dev/tty0?

  2. Cómo mapear dispositivos /dev/sdX y /dev/mapper/mpathY desde el dispositivo /dev/dm-Z

  3. fdisk:no se puede escribir /dev/sdg:descriptor de archivo incorrecto:error al formatear el disco USB

  4. ¿Cuándo debo usar /dev/shm/ y cuándo debo usar /tmp/?

  5. Linux:diferencia entre /dev/console, /dev/tty y /dev/tty0

tty (/dev/tty) vs pts (/dev/pts) en Linux

¿Cómo codificar en base64 /dev/random o /dev/urandom?

¿Cómo se intercambia /dev/sda con /dev/sdb?

Cómo usa Linux /dev/tty y /dev/tty0

hacer eco o imprimir /dev/stdin /dev/stdout /dev/stderr

¿Por qué se requieren < o > para usar /dev/tcp?