从具有“损坏的磁盘” Raid1 的服务器恢复数据

从具有“损坏的磁盘” Raid1 的服务器恢复数据

hetzner 上托管的服务器上的一个驱动器 (sdc) 已损坏,我无法安装驱动器来备份数据,以下是 df、fdisk、mdstat、检查输出

我想要做的是从 md3、md2 中恢复数据,这两个都处于非活动状态。

数据:

root@rescue ~ # df -H
Filesystem           Size  Used Avail Use% Mounted on
rootfs                17G   24M   17G   1% /
udev                  17G     0   17G   0% /dev
IP:/nfs  265G  129G  123G  52% /root/.oldroot/nfs
aufs                  17G   24M   17G   1% /
tmpfs                3.4G  320k  3.4G   1% /run
tmpfs                5.3M     0  5.3M   0% /run/lock
tmpfs                6.8G     0  6.8G   0% /run/shm

磁盘分区:

fdisk -l

Disk /dev/sda: 4000.8 GB, 4000787030016 bytes
255 heads, 63 sectors/track, 486401 cylinders, total 7814037168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0009b1c1

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    33556480    16777216+  fd  Linux raid autodetect
/dev/sda2        33558528    34607104      524288+  fd  Linux raid autodetect
/dev/sda3        34609152  1443194880   704292864+  fd  Linux raid autodetect
/dev/sda4      1443196928  5738164222  2147483647+   f  W95 Ext'd (LBA)
/dev/sda5      1443198976  5736069120  2146435072+  fd  Linux raid autodetect

Disk /dev/sdb: 4000.8 GB, 4000787030016 bytes
255 heads, 63 sectors/track, 486401 cylinders, total 7814037168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0003f2f6

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    33556480    16777216+  fd  Linux raid autodetect
/dev/sdb2        33558528    34607104      524288+  fd  Linux raid autodetect
/dev/sdb3        34609152  1443194880   704292864+  fd  Linux raid autodetect
/dev/sdb4      1443196928  5738164222  2147483647+   f  W95 Ext'd (LBA)
/dev/sdb5      1443198976  5736069120  2146435072+  fd  Linux raid autodetect

Disk /dev/md1: 536 MB, 536805376 bytes
2 heads, 4 sectors/track, 131056 cylinders, total 1048448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

这是 mdstat

root@rescue ~ # cat /proc/mdstat
Personalities : [raid1]
md3 : inactive sda5[0](S) sdb5[1](S)
      4292870128 blocks super 1.0

md2 : inactive sda3[0](S) sdb3[1](S)
      1408585712 blocks super 1.0

md1 : active raid1 sda2[0] sdb2[1]
      524224 blocks super 1.0 [3/2] [UU_]

md0 : inactive sda1[0](S) sdb1[1](S)
      33554416 blocks super 1.0

md2、md3、md0 显示为非活动状态

以下是 mdadm --examine

mdadm --examine /dev/sda1/ /dev/sdb1 /dev/sdc1
mdadm: cannot open /dev/sda1/: Not a directory
/dev/sdb1:
          Magic : a92b4efc
        Version : 1.0
    Feature Map : 0x0
     Array UUID : c587590d:f7caa7e8:55ca8b47:15eaf9dc
           Name : rescue:0  (local to host rescue)
  Creation Time : Mon Dec  8 20:43:21 2014
     Raid Level : raid0
   Raid Devices : 3

 Avail Dev Size : 33554416 (16.00 GiB 17.18 GB)
   Super Offset : 33554416 sectors
          State : clean
    Device UUID : 36bf3e8a:2b51ef66:b3b0aed6:f988ddc2

    Update Time : Mon Dec  8 20:43:21 2014
       Checksum : 8f266e36 - correct
         Events : 0

     Chunk Size : 512K

   Device Role : Active device 1
   Array State : AAA ('A' == active, '.' == missing)
mdadm: cannot open /dev/sdc1: No such file or directory

答案1

看起来 /dev/sda 是罪魁祸首。

我首先要备份未死机的磁盘(/dev/sdb),并将其存储在安全的地方。

dd if=/dev/sdb1 of=/someplace/safe/sdb1.img

对每个分区都执行此操作。一旦您对备份感到满意,您将需要使用 X 释放设备,mdadm -S mdX其中 X 是您要关闭的 raid 设备。

现在您应该能够使用mount /dev/sdb1 /mnt/...其中...是您为挂载点创建的目录来挂载该设备。

祝你好运。

相关内容