Como recuperar dados após lvremove em centos 7.0?

0

Eu fiz uma coisa estúpida removendo um volume lógico emitindo o comando abaixo.

lvremove -f /dev/cl_dhcppc4/home

No entanto, imediatamente eu restaurei o lvm do arquivo de backup.

vgcfgrestore --file /etc/lvm/archive/cl_dhcppc4_00001-1231497433.vg cl_dhcppc4

Mas não consegui montar esse volume lógico e acessar os dados nele. Eu posso ver o lvm e repectivo fdisk.Resultados abaixo.

[root@localhost lk]# lvdisplay -m
  --- Logical volume ---
  LV Path                /dev/cl_dhcppc4/swap
  LV Name                swap
  VG Name                cl_dhcppc4
  LV UUID                d0JfQW-CmGW-9gC8-C3I9-HH0c-x3EA-ZRu3qT
  LV Write Access        read/write
  LV Creation host, time dhcppc4, 2016-05-16 10:43:13 +0530
  LV Status              available
  # open                 0
  LV Size                7.75 GiB
  Current LE             1984
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

  --- Segments ---
  Logical extents 0 to 1983:
    Type                linear
    Physical volume     /dev/sda2
    Physical extents    0 to 1983


  --- Logical volume ---
  LV Path                /dev/cl_dhcppc4/home
  LV Name                home
  VG Name                cl_dhcppc4
  LV UUID                r1OcXu-JpSL-1pv5-oDPw-k9Q3-3ioS-hIeDnb
  LV Write Access        read/write
  LV Creation host, time dhcppc4, 2016-05-16 10:43:13 +0530
  LV Status              available
  # open                 0
  LV Size                873.21 GiB
  Current LE             223541
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

  --- Segments ---
  Logical extents 0 to 223540:
    Type                linear
    Physical volume     /dev/sda2
    Physical extents    1984 to 225524


  --- Logical volume ---
  LV Path                /dev/cl_dhcppc4/root
  LV Name                root
  VG Name                cl_dhcppc4
  LV UUID                MZTJcW-909k-cyjf-e3ls-K8hl-lYNm-Gk97kA
  LV Write Access        read/write
  LV Creation host, time dhcppc4, 2016-05-16 10:43:16 +0530
  LV Status              available
  # open                 1
  LV Size                50.00 GiB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Segments ---
  Logical extents 0 to 12799:
    Type                linear
    Physical volume     /dev/sda2
    Physical extents    225525 to 238324

Eu preciso recuperar os dados do caminho LV / dev / cl_dhcppc4 / home. Fdisk me dá resultado abaixo.

[root@localhost lk]# fdisk -l

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x000e45e4

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     1026047      512000   83  Linux
/dev/sda2   *     1026048  1953523711   976248832   8e  Linux LVM

Disk /dev/mapper/cl_dhcppc4-root: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/cl_dhcppc4-swap: 8321 MB, 8321499136 bytes, 16252928 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/cl_dhcppc4-home: 937.6 GB, 937598910464 bytes, 1831247872 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Se eu tentar montar o disco, ele fornecerá erros de tipo de sistema de arquivos para os tipos de arquivo nfs e ext3.

[root@localhost lk]# mount /dev/mapper/cl_dhcppc4-home /hd
mount: /dev/mapper/cl_dhcppc4-home is write-protected, mounting read-only
mount: unknown filesystem type '(null)'

[root@localhost lk]# mount -t nfs /dev/mapper/cl_dhcppc4-home /hd
mount.nfs: remote share not in 'host:dir' format

[root@localhost lk]# mount -t ext3 /dev/mapper/cl_dhcppc4-home /hd
mount: wrong fs type, bad option, bad superblock on /dev/mapper/cl_dhcppc4-home,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

Por favor ajude a recuperar os dados desta bagunça. Eu tinha alguns dados importantes neste disco.

    
por Karthikeyan Palanisamy 09.01.2017 / 05:06

2 respostas

0

@Bigon Para recuperar os dados, experimentei alguns comandos que poderiam ter mudado a topologia do LVM. Meu histroy entre lvremove e vgcfgrestore está abaixo. O Commnad 86 removeu o LVM e o comando 153 foi recuperado corretamente. Mas entre eu criei alguns lvm e os deletei também.

86  lvremove -f /dev/cl_dhcppc4/home
   87  lvscan
   88  lvremove -f /dev/cl_dhcppc4/home
   89  fdisk -l
   90  mount /dev/sda2 /dev/sda2
   91  lvscan
   92  mount
   94  lvdisplay cl_dhcppc4
  100  lvcreate --extents EFROM-ETO --zero n --name customer007 YOUR-VG-NAME /dev/yourpv:PFROM-PTO
  101  lvcreate --extents EFROM-ETO --zero n --name test007 test007   /dev/sda2:PFROM-PTO
  102  lvcreate --help
  103  lvcreate /dev/sda2
  104  fdisk -l
  105  pvs
  106  lvdisplay cl_dhcppc4
  110  lvdisplay
  111  dmsetup ls
  112  dmsetup table cl_dhcppc4-home
  113  dmsetup table cl_dhcppc4-root
  116  pvcreate /dev/sda2
  117  pvcreate -ff  /dev/sda2
  118  vgcreate vgpool /dev/sda2
  119  pvcreate -ff  /dev/sda2
  120  pvs
  121  sh /etc/rd.d/rc.lvm2 start
  122  vgscan
  123  vgchange --available n
  124  lvcreate -L 3G -n cl_dhcppc4 vgpool
  125  lvcreate -L 3G -n lvstuff cl_dhcppc4
  129  lvcreate -l 20 -n logical_vol1 cl_dhcppc4 
  130  lvdisplay
  131  lvremove /dev/cl_dhcppc4/lvstuff
  132  lvremove /dev/cl_dhcppc4/logical_vol1
  152  vgcfgrestore –file /etc/lvm/archive/cl_dhcppc4_00001-1231497433.vg
  153  vgcfgrestore –file /etc/lvm/archive/cl_dhcppc4_00001-1231497433.vg cl_dhcppc4

O lsblk não está mostrando o FSTYPE e o UUID para o sistema de arquivos afetado cl_dhcppc4-home.

 [root@localhost lk]# lsblk -f
NAME                FSTYPE      LABEL UUID                                   MOUNTPOINT
sda                                                                          
├─sda1              xfs               acc94e95-aff5-44dc-acd6-e53ab9b85970   
└─sda2              LVM2_member       V3EMqc-bTyq-v8fz-vZfU-bUvv-torq-lEitpO 
  ├─cl_dhcppc4-root xfs               6d107d35-4ba3-4f08-97ca-ac33338cf97c   /
  ├─cl_dhcppc4-swap swap              f452dcca-9254-42e4-bee6-dc9c760ade58   
  └─cl_dhcppc4-home                                                          
sr0        
    
por 11.01.2017 / 17:31
0

Não cheira bem para mim. Eu não acho que o FS ainda é utilizável aqui. Você provavelmente precisará recuperar os dados de outra maneira, talvez dê uma olhada no link

    
por 11.01.2017 / 17:58