centos 7.0 lvremove 이후 데이터를 복구하는 방법은 무엇입니까?

centos 7.0 lvremove 이후 데이터를 복구하는 방법은 무엇입니까?

나는 어리석은 짓을 해서 다음 명령을 실행하여 논리 볼륨을 삭제했습니다.

lvremove -f /dev/cl_dhcppc4/home

그러나 즉시 백업 파일에서 lvm을 복원했습니다.

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

하지만 이 논리 볼륨을 마운트하고 그 안에 있는 데이터에 액세스할 수 없습니다. lvm과 해당 fdisk를 볼 수 있습니다. 결과는 다음과 같습니다.

[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

LV 경로 /dev/cl_dhcppc4/home에서 데이터를 복원해야 합니다. Fdisk는 다음과 같은 결과를 제공합니다.

[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

디스크를 마운트하려고 하면 nfs, 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.

이 혼란으로부터 데이터를 복구하는 데 도움을 주세요. 이 디스크에 몇 가지 중요한 데이터가 있습니다.

답변1

@Bigon 데이터를 검색하기 위해 직접 시도해 보고 LVM 토폴로지를 변경할 수 있는 몇 가지 명령을 실행했습니다. lvremove와 vgcfgrestore 사이의 내 기록은 다음과 같습니다. Commnad 86이 LVM을 제거했으며 명령 153이 올바르게 검색되었습니다. 하지만 그 동안 일부 lvm을 만들고 삭제했습니다.

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

lsblk는 영향을 받은 파일 시스템 cl_dhcppc4-home의 FSTYPE 및 UUID를 표시하지 않습니다.

 [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        

답변2

냄새가 좋지 않은 것 같아요. 나는 FS가 여기서 여전히 유용하다고 생각하지 않습니다. 다른 방법으로 데이터를 복구해야 할 수도 있습니다.https://help.ubuntu.com/community/DataRecovery

관련 정보