从专用服务器上抢救RAID 1

我有一个专用的服务器(Hetzner EX4)。 有一天,我重新启动服务器,它不会启动。 客服告诉我,其中一块硬盘出现故障,并启动了救援系统(Linux)。 我的服务器有2个3TB硬盘,Raid1(几乎可以肯定这个!)

所以,我认为至less有一个驱动器可能是可用的,但我不知道如何从我的服务器中获取数据。 我有一些研究,并尝试使用partimage(和partimage服务器),但由于我不知道如何磁盘和分区在Linux中的作品,我不知道如何从服务器中获取数据。

我什至不知道我看到的是驱动器,分区或什么!

不知道,但我认为这可能是有用的:

root@rescue /dev # cd dev/ -bash: cd: dev/: No such file or directory root@rescue /dev # dir 1-1 cpu full loop4 mouse1 ptyp2 ptype ram4 sda3 stderr tty16 tty27 tty38 tty49 tty6 ttyp4 ttyS0 vcs2 vga_arbiter 2-1 cpu_dma_latency fuse loop5 net ptyp3 ptypf ram5 sda4 stdin tty17 tty28 tty39 tty5 tty60 ttyp5 ttyS1 vcs3 vhost-net 2-1.4 disk hpet loop6 network_latency ptyp4 ram0 ram6 sda5 stdout tty18 tty29 tty4 tty50 tty61 ttyp6 ttyS2 vcs4 watchdog 2-1.6 event0 input loop7 network_throughput ptyp5 ram1 ram7 sdb tty tty19 tty3 tty40 tty51 tty62 ttyp7 ttyS3 vcs5 watchdog0 autofs event1 kmem loop-control null ptyp6 ram10 ram8 sdb1 tty0 tty2 tty30 tty41 tty52 tty63 ttyp8 urandom vcs6 xconsole block event2 kmsg MAKEDEV port ptyp7 ram11 ram9 sdb2 tty1 tty20 tty31 tty42 tty53 tty7 ttyp9 usbmon0 vcsa zero bsg event3 kvm mapper ppp ptyp8 ram12 random sdb3 tty10 tty21 tty32 tty43 tty54 tty8 ttypa usbmon1 vcsa1 btrfs-control event4 log md psaux ptyp9 ram13 rtc sdb4 tty11 tty22 tty33 tty44 tty55 tty9 ttypb usbmon2 vcsa2 bus event5 loop0 mem ptmx ptypa ram14 rtc0 sdb5 tty12 tty23 tty34 tty45 tty56 ttyp0 ttypc usbmon3 vcsa3 char event6 loop1 mice pts ptypb ram15 sda sg0 tty13 tty24 tty35 tty46 tty57 ttyp1 ttypd usbmon4 vcsa4 console fb0 loop2 microcode ptyp0 ptypc ram2 sda1 sg1 tty14 tty25 tty36 tty47 tty58 ttyp2 ttype vcs vcsa5 core fd loop3 mouse0 ptyp1 ptypd ram3 sda2 shm tty15 tty26 tty37 tty48 tty59 ttyp3 ttypf vcs1 vcsa6 root@rescue /dev # fdisk -l WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted. Disk /dev/sdb: 3000.6 GB, 3000592982016 bytes 256 heads, 63 sectors/track, 363376 cylinders, total 5860533168 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 identifier: 0x8ab49420 Device Boot Start End Blocks Id System /dev/sdb1 1 4294967295 2147483647+ ee GPT Partition 1 does not start on physical sector boundary. WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted. Disk /dev/sda: 3000.6 GB, 3000592982016 bytes 256 heads, 63 sectors/track, 363376 cylinders, total 5860533168 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 identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sda1 1 4294967295 2147483647+ ee GPT Partition 1 does not start on physical sector boundary. root@rescue /dev # 

任何人都可以请给我一些build议,或指出我正确的方向来解决我的问题? 也许我做错了,我应该采取另一种方法,或者根本不可能:/

更新1首先,让我感谢你的所有build议。 我已经尝试了一些东西,但不知道结果是什么意思..

首先,你已经看到了fdisk -l的结果(我不确定/ dev / sda是​​否有磁盘标识符:0x00000000是一个线索..

我试图挂载/dev/sda1 ,它工作。 但是,如果我进入该目录,则只能看到EFI文件夹。 这是正常的吗?

此外,如果我尝试挂载/dev/sdb1 ,则会得到“挂载:您必须指定文件系统types”。

如果我运行cat /proc/mdstat我得到这个:

 Personalities : [raid1] unused devices: <none> 

更新2根据Cristian Ciupitu的build议,我在两个驱动器上运行smartctl,结果如下:

深发展:

 root@rescue / # smartctl -l error /dev/sdb smartctl 5.41 2011-06-09 r3365 [x86_64-linux-3.10.36] (local build) Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net === START OF READ SMART DATA SECTION === SMART Error Log Version: 1 ATA Error Count: 242 (device log contains only the most recent five errors) CR = Command Register [HEX] FR = Features Register [HEX] SC = Sector Count Register [HEX] SN = Sector Number Register [HEX] CL = Cylinder Low Register [HEX] CH = Cylinder High Register [HEX] DH = Device/Head Register [HEX] DC = Device Command Register [HEX] ER = Error register [HEX] ST = Status register [HEX] Powered_Up_Time is measured from power on, and printed as DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes, SS=sec, and sss=millisec. It "wraps" after 49.710 days. Error 242 occurred at disk power-on lifetime: 20101 hours (837 days + 13 hours) When the command that caused the error occurred, the device was active or idle. After command completion occurred, registers were: ER ST SC SN CL CH DH -- -- -- -- -- -- -- 40 51 00 8c fe a2 0b Error: UNC at LBA = 0x0ba2fe8c = 195231372 Commands leading to the command that caused the error were: CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name -- -- -- -- -- -- -- -- ---------------- -------------------- 60 00 01 8c fe a2 4b 00 7d+19:32:38.593 READ FPDMA QUEUED ef 10 02 00 00 00 a0 00 7d+19:32:38.559 SET FEATURES [Reserved for Serial ATA] 27 00 00 00 00 00 e0 00 7d+19:32:38.559 READ NATIVE MAX ADDRESS EXT ec 00 00 00 00 00 a0 00 7d+19:32:38.559 IDENTIFY DEVICE ef 03 46 00 00 00 a0 00 7d+19:32:38.559 SET FEATURES [Set transfer mode] Error 241 occurred at disk power-on lifetime: 20101 hours (837 days + 13 hours) When the command that caused the error occurred, the device was active or idle. After command completion occurred, registers were: ER ST SC SN CL CH DH -- -- -- -- -- -- -- 40 51 00 8b fe a2 0b Error: UNC at LBA = 0x0ba2fe8b = 195231371 Commands leading to the command that caused the error were: CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name -- -- -- -- -- -- -- -- ---------------- -------------------- 60 00 01 8c fe a2 4b 00 7d+19:32:35.600 READ FPDMA QUEUED 60 00 01 8b fe a2 4b 00 7d+19:32:35.600 READ FPDMA QUEUED ef 10 02 00 00 00 a0 00 7d+19:32:35.567 SET FEATURES [Reserved for Serial ATA] 27 00 00 00 00 00 e0 00 7d+19:32:35.567 READ NATIVE MAX ADDRESS EXT ec 00 00 00 00 00 a0 00 7d+19:32:35.566 IDENTIFY DEVICE Error 240 occurred at disk power-on lifetime: 20101 hours (837 days + 13 hours) When the command that caused the error occurred, the device was active or idle. After command completion occurred, registers were: ER ST SC SN CL CH DH -- -- -- -- -- -- -- 40 51 00 8d fe a2 0b Error: UNC at LBA = 0x0ba2fe8d = 195231373 Commands leading to the command that caused the error were: CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name -- -- -- -- -- -- -- -- ---------------- -------------------- 60 00 01 8b fe a2 4b 00 7d+19:32:32.607 READ FPDMA QUEUED 60 00 01 8c fe a2 4b 00 7d+19:32:32.606 READ FPDMA QUEUED 60 00 01 8d fe a2 4b 00 7d+19:32:32.606 READ FPDMA QUEUED ef 10 02 00 00 00 a0 00 7d+19:32:32.574 SET FEATURES [Reserved for Serial ATA] 27 00 00 00 00 00 e0 00 7d+19:32:32.573 READ NATIVE MAX ADDRESS EXT Error 239 occurred at disk power-on lifetime: 20101 hours (837 days + 13 hours) When the command that caused the error occurred, the device was active or idle. After command completion occurred, registers were: ER ST SC SN CL CH DH -- -- -- -- -- -- -- 40 51 00 8a fe a2 0b Error: UNC at LBA = 0x0ba2fe8a = 195231370 Commands leading to the command that caused the error were: CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name -- -- -- -- -- -- -- -- ---------------- -------------------- 60 00 01 8d fe a2 4b 00 7d+19:32:29.563 READ FPDMA QUEUED 60 00 01 8c fe a2 4b 00 7d+19:32:29.563 READ FPDMA QUEUED 60 00 01 8b fe a2 4b 00 7d+19:32:29.563 READ FPDMA QUEUED 60 00 01 8a fe a2 4b 00 7d+19:32:29.563 READ FPDMA QUEUED ef 10 02 00 00 00 a0 00 7d+19:32:29.531 SET FEATURES [Reserved for Serial ATA] Error 238 occurred at disk power-on lifetime: 20101 hours (837 days + 13 hours) When the command that caused the error occurred, the device was active or idle. After command completion occurred, registers were: ER ST SC SN CL CH DH -- -- -- -- -- -- -- 40 51 00 8e fe a2 0b Error: UNC at LBA = 0x0ba2fe8e = 195231374 Commands leading to the command that caused the error were: CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name -- -- -- -- -- -- -- -- ---------------- -------------------- 60 00 01 8a fe a2 4b 00 7d+19:32:26.521 READ FPDMA QUEUED 60 00 01 8b fe a2 4b 00 7d+19:32:26.521 READ FPDMA QUEUED 60 00 01 8c fe a2 4b 00 7d+19:32:26.521 READ FPDMA QUEUED 60 00 01 8d fe a2 4b 00 7d+19:32:26.521 READ FPDMA QUEUED 60 00 01 8e fe a2 4b 00 7d+19:32:26.520 READ FPDMA QUEUED 

SDA:

 root@rescue / # smartctl -t short /dev/sda smartctl 5.41 2011-06-09 r3365 [x86_64-linux-3.10.36] (local build) Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net Short INQUIRY response, skip product id A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options. 

更新3我做了一个lsblkfind哪些分区有数据:

 root@rescue / # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 2.7T 0 disk ├─sda1 8:1 0 200M 0 part ├─sda2 8:2 0 1M 0 part ├─sda3 8:3 0 127M 0 part ├─sda4 8:4 0 2.7T 0 part /mnt └─sda5 8:5 0 455.5K 0 part sdb 8:16 0 2.7T 0 disk ├─sdb1 8:17 0 1M 0 part ├─sdb2 8:18 0 127M 0 part ├─sdb3 8:19 0 200M 0 part ├─sdb4 8:20 0 2.7T 0 part └─sdb5 8:21 0 455.5K 0 part loop0 7:0 0 1.5G 1 loop 

然后我登上了sda4。 我可以看到文件系统(Windows中的C单元),但当我进入一个目录(让我们说“程序文件”),并尝试列出所有文件,我得到一个IO错误:

 dir: reading directory .: Input/output error 

我尝试使用ncftpput通过ftp发送所有文件系统,并且大部分文件都抛出了IOexception。

如果我尝试挂载sdb4,我得到这个错误:

 root@rescue / # mount /dev/sdb4 /mnt ntfs_attr_pread_i: ntfs_pread failed: Input/output error Failed to read vcn 0x28: Input/output error Failed to mount '/dev/sdb4': Input/output error NTFS is either inconsistent, or there is a hardware fault, or it's a SoftRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows then reboot into Windows twice. The usage of the /f parameter is very important! If the device is a SoftRAID/FakeRAID then first activate it and mount a different device under the /dev/mapper/ directory, (eg /dev/mapper/nvidia_eahaabcc1). Please see the 'dmraid' documentation for more details. 

更新4

我试过ntfsfix没有运气:

 root@rescue / # ntfsfix /dev/sdb4 Mounting volume... ntfs_attr_pread_i: ntfs_pread failed: Input/output error Failed to read vcn 0x28: Input/output error FAILED Attempting to correct errors... Processing $MFT and $MFTMirr... Reading $MFT... OK Reading $MFTMirr... OK Comparing $MFTMirr to $MFT... OK Processing of $MFT and $MFTMirr completed successfully. Setting required flags on partition... OK Going to empty the journal ($LogFile)... OK ntfs_attr_pread_i: ntfs_pread failed: Input/output error Failed to read vcn 0x28: Input/output error Remount failed: Input/output error 

首先,检查你的备份。 如果一切顺利,你将不需要它们,但是当你知道你的数据是安全的,并且你可以在没有完全理解的情况下冒险的话,它会有很大的帮助。

接下来找出你使用的RAID。 它可以是硬件RAID,但也可以是像mdadm这样的软件RAID。 除非你记得硬件RAID mdadmn是可能的。 确认并阅读mdadm手册页。

接下来找出哪个磁盘坏了,哪个还好。

安装可以获得降级RAID1的磁盘。 为了这个检查cat /proc/mdstat 。 你很幸运,你会得到类似这样的输出:

 cat / proc / mdstat
个性:[线性] [多path] [raid0] [raid1] [raid5] [raid4] [raid6] [raid10]
 md0:激活raid1 sda1 [0] sdb1 [2](F)
       24418688 blocks [2/1] [U_]

在这个例子中,mdadm被加载并且识别出第二个磁盘失败了。 如果你没有得到这个输出,检查你的内核是否支持mdadm,或者是否加载了正确的模块。 可选地创build一个新的MD设备。 去回忆这个命令是mdadm --create /dev/md0 --level=1 --raid-devices=2 missing /dev/sdb2 。 (检查这个!并且意识到这是假定第二个驱动器失败,如果是第一个写入,那么创build一个sda丢失!)。

一旦你得到一个工作/ dev / mdX设备将所有的数据复制到一个备用的位置。 你可能不需要它,但你想确保你的备份完全是最新的。 然后才要求您的提供商将损坏的磁盘换成新磁盘,然后将新磁盘添加到RAIDarrays。

caveeats:

  1. 这假设你有备份,或者可以阅读手册。
  2. 这假定磁盘被分区为一个大的RAID1。 这可能,但不能保证。 (可以将磁盘分区为多个分区,并对其进行RAID)。 然而,最小努力的path将是一个大的RAID1磁盘,并且因为它工作较less,所以主要使用的是默认的。

您需要更换磁盘。 现在。

对于Linux,您的arrays将显示为一个单独的驱动器,除非分区不同或由控制器分隔到不同的虚拟磁盘。 您应该能够使用串行控制台(如果由主机提供)引导到您的服务器的控制器,并看看它是如何configuration的。

但是,更换磁盘或者感到抱歉。 根据驱动器的使用年限,第二个驱动器可能已经接近故障时间,并且您确实希望故障发生之前完成重build。

你可能想用一个好的驱动器replace坏的硬盘驱动器,它应该自行修复。 尽pipe您的RAID实施可能有所不同,您可能需要咨询供应商的文档以获取进一步的指导。 但是,如果文件系统被软件损坏,而不是硬盘损坏,则RAID不能防止这种情况发生(例如,两个硬盘上的坏写入都会发生)。

您应该可以挂载仍在线的硬盘。

尝试mount /dev/sda1 /mnt命令

如果这个命令起作用,它将挂载/mnt下的文件系统。 导航到该文件夹​​,你应该能够看到文件和文件夹。 只需备份你需要的信息,并按照乔纳森的build议。