Removendo vg e lv após a unidade física ter sido removida

29

Ocorreu uma falha no disco em um servidor e o substituiu antes de remover a unidade do LVM.

O servidor tem 4 unidades físicas (PVs), cada uma com seu próprio grupo de volume (VG). Cada VG tem 2 ou mais volumes lógicos (LV's). Agora, o LVM está reclamando da unidade ausente. Portanto, temos um VG (vg04) com dois LVs que se tornaram órfãos do que precisamos eliminar do sistema.

O problema é que toda vez que executamos qualquer comando LVM, recebemos esses erros de 'leitura falhada':

# lvscan
  /dev/vg04/swap: read failed after 0 of 4096 at 4294901760: Input/output error
  /dev/vg04/swap: read failed after 0 of 4096 at 4294959104: Input/output error
  /dev/vg04/swap: read failed after 0 of 4096 at 0: Input/output error
  /dev/vg04/swap: read failed after 0 of 4096 at 4096: Input/output error
  /dev/vg04/vz: read failed after 0 of 4096 at 995903864832: Input/output error
  /dev/vg04/vz: read failed after 0 of 4096 at 995903922176: Input/output error
  /dev/vg04/vz: read failed after 0 of 4096 at 0: Input/output error
  /dev/vg04/vz: read failed after 0 of 4096 at 4096: Input/output error

# vgreduce vg04 --removemissing --force
  /dev/vg04/swap: read failed after 0 of 4096 at 4294901760: Input/output error
  /dev/vg04/swap: read failed after 0 of 4096 at 4294959104: Input/output error
  /dev/vg04/swap: read failed after 0 of 4096 at 0: Input/output error
  /dev/vg04/swap: read failed after 0 of 4096 at 4096: Input/output error
  /dev/vg04/vz: read failed after 0 of 4096 at 995903864832: Input/output error
  /dev/vg04/vz: read failed after 0 of 4096 at 995903922176: Input/output error
  /dev/vg04/vz: read failed after 0 of 4096 at 0: Input/output error
  /dev/vg04/vz: read failed after 0 of 4096 at 4096: Input/output error
  Volume group "vg04" not found

# vgchange -a n /dev/vg04
  /dev/vg04/swap: read failed after 0 of 4096 at 4294901760: Input/output error
  /dev/vg04/swap: read failed after 0 of 4096 at 4294959104: Input/output error
  /dev/vg04/swap: read failed after 0 of 4096 at 0: Input/output error
  /dev/vg04/swap: read failed after 0 of 4096 at 4096: Input/output error
  /dev/vg04/vz: read failed after 0 of 4096 at 995903864832: Input/output error
  /dev/vg04/vz: read failed after 0 of 4096 at 995903922176: Input/output error
  /dev/vg04/vz: read failed after 0 of 4096 at 0: Input/output error
  /dev/vg04/vz: read failed after 0 of 4096 at 4096: Input/output error
  Volume group "vg04" not found

# lvchange -a n /dev/vg04/vz
  /dev/vg04/swap: read failed after 0 of 4096 at 4294901760: Input/output error
  /dev/vg04/swap: read failed after 0 of 4096 at 4294959104: Input/output error
  /dev/vg04/swap: read failed after 0 of 4096 at 0: Input/output error
  /dev/vg04/swap: read failed after 0 of 4096 at 4096: Input/output error
  /dev/vg04/vz: read failed after 0 of 4096 at 995903864832: Input/output error
  /dev/vg04/vz: read failed after 0 of 4096 at 995903922176: Input/output error
  /dev/vg04/vz: read failed after 0 of 4096 at 0: Input/output error
  /dev/vg04/vz: read failed after 0 of 4096 at 4096: Input/output error
  Volume group "vg04" not found
  Skipping volume group vg04

Os VGs e LVs ausentes não são importantes, só queremos removê-los.

Como você pode ver, tentamos todas as sugestões feitas até agora sem sorte.

A saída de 'lvm dumpconfig' pode ser verificada no link

    
por RCD 27.08.2012 / 23:02

3 respostas

41

A solução foi executar o dmsetup, neste caso os dois comandos

dmsetup remove vg04-vz
dmsetup remove vg04-swap

Antes de fazer isso, verifiquei com o comando 'dmsetup info' que a 'contagem aberta' para ambos os LVs era zero.

ATENÇÃO: O dmsetup pode causar sérios danos aos seus discos para que qualquer pessoa que use esta informação no futuro, por favor, leia a man page.

    
por 02.09.2012 / 05:16
7

Eu tive uma experiência semelhante depois de remover um disco VMware /dev/sdb .

Use lsscsi para determinar qual dispositivo está sendo usado (talvez seja necessário instalar o programa) em seguida, execute lsscsi :

# lsscsi
[1:0:0:0]    cd/dvd  NECVMWar VMware IDE CDR10 1.00  /dev/sr0
[2:0:0:0]    disk    VMware   Virtual disk     1.0   /dev/sda
[2:0:1:0]    disk    VMware   Virtual disk     1.0   /dev/sdb <== the removed physical disk
[2:0:2:0]    disk    VMware   Virtual disk     1.0   /dev/sdc

Agora escreva o arquivo de exclusão com

# echo 1 > /sys/class/scsi_device/2\:0\:1\:0/device/delete

O dispositivo desapareceu imediatamente.

    
por 24.06.2013 / 10:53
1

vgchange -a n /dev/vg04

Se você tiver volumes lógicos ainda ativos, talvez seja necessário

lvchange -a n /dev/vg04/swap
lvchange -a n dev/vg04/vz

etc.

    
por 28.08.2012 / 15:39