在 Hetzner 主机上以恢复模式安装有缺陷的 RAID 驱动器?

Mount defective RAID drive at Recovery mode on Hetzner hosting?

我在 Hetzner 的服务器崩溃了。并非所有数据都已备份。请帮我挂载和修复崩溃磁盘中的数据。 任何帮助都会非常好。

这里是 mdstat 信息:

root@rescue ~ # cat /proc/mdstat
Personalities : [raid1]  md2 : active raid1 sdb3[1]
      1927689152 blocks super 1.2 [2/1] [_U]
       md0 : active raid1 sda1[0] sdb1[1]
      25149312 blocks super 1.2 [2/2] [UU]
       md1 : active raid1 sda2[0]
      523968 blocks super 1.2 [2/1] [U_]
       unused devices: <none>

Fdisk信息:

root@rescue ~ # fdisk -l

Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 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: 0x0006cff0

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    50333696    25165824+  fd  Linux raid autodetect
/dev/sda2        50335744    51384320      524288+  fd  Linux raid autodetect
/dev/sda3        51386368  3907027120  1927820376+  fd  Linux raid autodetect

Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 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: 0x000e2728

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    50333696    25165824+  fd  Linux raid autodetect
/dev/sdb2        50335744    51384320      524288+  fd  Linux raid autodetect
/dev/sdb3        51386368  3907027120  1927820376+  fd  Linux raid autodetect

Disk /dev/md1: 536 MB, 536543232 bytes
2 heads, 4 sectors/track, 130992 cylinders, total 1047936 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

Disk /dev/md1 doesn't contain a valid partition table

Disk /dev/md0: 25.8 GB, 25752895488 bytes
2 heads, 4 sectors/track, 6287328 cylinders, total 50298624 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

Disk /dev/md0 doesn't contain a valid partition table

Disk /dev/md2: 1974.0 GB, 1973953691648 bytes
2 heads, 4 sectors/track, 481922288 cylinders, total 3855378304 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

Disk /dev/md2 doesn't contain a valid partition table

/md0 是交换..:[=​​19=]

root@rescue ~ # mount /dev/md0 ./mnt2
/dev/md0 looks like swapspace - not mounted
mount: you must specify the filesystem type

挂载成功/dev/md1:

mount /dev/md1 ./mnt/

但是这些文件没用:

root@rescue ~/mnt # ls
abi-3.13.0-37-generic  boot                      config-3.13.0-66-generic      initrd.img-3.13.0-49-generic  System.map-3.13.0-37-generic  vmlinuz-3.13.0-37-generic
abi-3.13.0-49-generic  config-3.13.0-37-generic  grub                          initrd.img-3.13.0-66-generic  System.map-3.13.0-49-generic  vmlinuz-3.13.0-49-generic
abi-3.13.0-66-generic  config-3.13.0-49-generic  initrd.img-3.13.0-37-generic  lost+found                    System.map-3.13.0-66-generic  vmlinuz-3.13.0-66-generic

下一个..

root@rescue ~ # mount /dev/md2 ./mnt2
mount: Stale NFS file handle

mdadm 说:

root@rescue ~ # mdadm -E -s 
ARRAY /dev/md/1 metadata=1.2 UUID=81310c9d:bffcc81e:a2da516c:17950be1 name=rescue:1
ARRAY /dev/md/0 metadata=1.2 UUID=b8c0db78:11d75c0c:ee97c975:7f6dcfd5 name=rescue:0
ARRAY /dev/md/2 metadata=1.2 UUID=df88a4f2:bc751f21:609301cf:7336becf name=rescue:2

下一步..

root@rescue ~ # fsck /dev/md2
fsck from util-linux 2.20.1
e2fsck 1.42.5 (29-Jul-2012)
ext2fs_check_desc: Corrupt group descriptor: bad block for block bitmap
fsck.ext4: Group descriptors look bad... trying backup blocks...
fsck.ext4: Attempt to read block from filesystem resulted in short read while using the backup blocksfsck.ext4: going back to original superblock
/dev/md2 contains a file system with errors, check forced.
fsck.ext4: A block group is missing an inode table while reading bad blocks inode
This doesn't bode well, but we'll try to go on...
Pass 1: Checking inodes, blocks, and sizes
Group 2's inode table at 33554432 conflicts with some other fs block.
Relocate<y>? yes
Group 2's block bitmap at 33554432 conflicts with some other fs block.
Relocate<y>? yes

使用 -y 重新启动:

root@rescue ~ # fsck /dev/md2 -y
...
Error reading block 24117281 (Attempt to read block from filesystem resulted in short read) while getting next inode from scan.  Ignore error? yes

Force rewrite? yes
... (many of them)
...
fsck.ext4: e2fsck_read_bitmaps: illegal bitmap block(s) for /dev/md2
/dev/md2: ***** FILE SYSTEM WAS MODIFIED *****
e2fsck: aborted
/dev/md2: ***** FILE SYSTEM WAS MODIFIED *****

请给我一个方向或任何移动建议。

看来我找到了解决方案:

root@rescue ~ # mdadm -A -R /dev/md9 /dev/sda3
mdadm: /dev/md9 has been started with 1 drive (out of 2).
root@rescue ~ # mount /dev/md9 ./mnt

感谢https://blog.sleeplessbeastie.eu/2012/05/08/how-to-mount-software-raid1-member-using-mdadm/