Debian 8.7 mdadm - 删除备用磁盘并重新安装映像后无法将其重新添加到 RAID1

Debian 8.7 mdadm - 删除备用磁盘并重新安装映像后无法将其重新添加到 RAID1

尝试将两个磁盘从 raid1 更改为 raid0 时,我将其中一个磁盘标记为故障并从阵列中删除,后来由于无法删除第二个磁盘,我产生了一个糟糕的想法,即通过 Web 管理器重新安装 Linux 映像。我通过 putty 访问服务器,无需物理访问。

结果:现在我只能在救援模式下访问 shell。还没有找到任何方法来重新添加已删除的磁盘。我尝试的几乎所有方法都返回“设备繁忙”类型的错误消息。

这里有一些输出:

root@rescue ~ # cat /proc/mdstat
Personalities : [raid1] [raid0]
md3 : inactive sdb4[0] sda4[1](S)
      3694957447 blocks super 1.2

md2 : active raid1 sdb3[0] sda3[1]
      1073610752 blocks super 1.2 [2/2] [UU]
      bitmap: 0/8 pages [0KB], 65536KB chunk

md1 : active raid1 sdb2[0] sda2[1]
      523712 blocks super 1.2 [2/2] [UU]

md0 : active raid1 sdb1[0] sda1[1]
      8380416 blocks super 1.2 [2/2] [UU]

unused devices: <none>

root@rescue ~ # mdadm --detail /dev/md3
/dev/md3:
        Version : 1.2
  Creation Time : Sat Feb 11 21:04:29 2017
     Raid Level : raid0
   Raid Devices : 1
  Total Devices : 2
    Persistence : Superblock is persistent

    Update Time : Sat Feb 18 23:50:30 2017
          State : active, Not Started
 Active Devices : 1
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 1

     Chunk Size : 64K

           Name : rescue:3  (local to host rescue)
           UUID : 22a8c922:44560691:9e731044:73ff2645
         Events : 4390

    Number   Major   Minor   RaidDevice State
       0       8       20        0      active sync   /dev/sdb4

       1       8        4        -      spare   /dev/sda4

root@rescue ~ # lsblk
NAME    MAJ:MIN RM    SIZE RO TYPE  MOUNTPOINT
sdb       8:16   0    2.7T  0 disk
├─sdb4    8:20   0    1.7T  0 part
├─sdb2    8:18   0    512M  0 part
│ └─md1   9:1    0  511.4M  0 raid1
├─sdb5    8:21   0      1M  0 part
├─sdb3    8:19   0      1T  0 part
│ └─md2   9:2    0 1023.9G  0 raid1
└─sdb1    8:17   0      8G  0 part
  └─md0   9:0    0      8G  0 raid1
loop0     7:0    0      2G  1 loop
sda       8:0    0    2.7T  0 disk
├─sda4    8:4    0    1.7T  0 part
├─sda2    8:2    0    512M  0 part
│ └─md1   9:1    0  511.4M  0 raid1
├─sda5    8:5    0      1M  0 part
├─sda3    8:3    0      1T  0 part
│ └─md2   9:2    0 1023.9G  0 raid1
└─sda1    8:1    0      8G  0 part
  └─md0   9:0    0      8G  0 raid1

root@rescue ~ # mdadm -a /dev/md3 /dev/sda4
mdadm: Cannot open /dev/sda4: Device or resource busy

root@rescue ~ # mdadm --stop /dev/md3
mdadm: Cannot get exclusive access to /dev/md3:Perhaps a running process, mounted filesystem or active volume group?

root@rescue ~ # mdadm --assemble --force /dev/md3 /dev/sd[ab]4
mdadm: /dev/sda4 is busy - skipping
mdadm: /dev/sdb4 is busy - skipping

root@rescue ~ # mdadm --assemble --force /dev/md3 /dev/sd[a]4
mdadm: /dev/sda4 is busy - skipping

root@rescue ~ # cat /etc/mdadm/mdadm.conf
# mdadm.conf
#
# Please refer to mdadm.conf(5) for information about this file.
#

# by default (built-in), scan all partitions (/proc/partitions) and all
# containers for MD superblocks. alternatively, specify devices to scan, using
# wildcards if desired.
#DEVICE partitions containers

# auto-create devices with Debian standard permissions
CREATE owner=root group=disk mode=0660 auto=yes

# automatically tag new arrays as belonging to the local system
HOMEHOST <system>

# instruct the monitoring daemon where to send mail alerts
MAILADDR root

# definitions of existing MD arrays
ARRAY /dev/md/0  metadata=1.2 UUID=c3c0b75a:8735901e:f41e750c:3dd667c2 name=rescue           :0
ARRAY /dev/md/1  metadata=1.2 UUID=d760489f:0bd0b506:d60e62f6:1f9dc848 name=rescue           :1
ARRAY /dev/md/2  metadata=1.2 UUID=c479d9a0:bc0ef6d0:29f2fcac:097a8f73 name=rescue           :2
ARRAY /dev/md/3  metadata=1.2 UUID=22a8c922:44560691:9e731044:73ff2645 name=rescue           :3
   spares=1

# This configuration was auto-generated on Sun, 19 Feb 2017 20:14:21 +0100 by mkco           nf
ARRAY /dev/md/0  metadata=1.2 UUID=c3c0b75a:8735901e:f41e750c:3dd667c2 name=rescue           :0
ARRAY /dev/md/1  metadata=1.2 UUID=d760489f:0bd0b506:d60e62f6:1f9dc848 name=rescue           :1
ARRAY /dev/md/2  metadata=1.2 UUID=c479d9a0:bc0ef6d0:29f2fcac:097a8f73 name=rescue           :2
ARRAY /dev/md/3  metadata=1.2 UUID=22a8c922:44560691:9e731044:73ff2645 name=rescue           :3
   spares=1

root@rescue ~ # fdisk -l

Disk /dev/ram0: 64 MiB, 67108864 bytes, 131072 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/ram1: 64 MiB, 67108864 bytes, 131072 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/ram2: 64 MiB, 67108864 bytes, 131072 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/ram3: 64 MiB, 67108864 bytes, 131072 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/ram4: 64 MiB, 67108864 bytes, 131072 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/ram5: 64 MiB, 67108864 bytes, 131072 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/ram6: 64 MiB, 67108864 bytes, 131072 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/ram7: 64 MiB, 67108864 bytes, 131072 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/ram8: 64 MiB, 67108864 bytes, 131072 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/ram9: 64 MiB, 67108864 bytes, 131072 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/ram10: 64 MiB, 67108864 bytes, 131072 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/ram11: 64 MiB, 67108864 bytes, 131072 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/ram12: 64 MiB, 67108864 bytes, 131072 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/ram13: 64 MiB, 67108864 bytes, 131072 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/ram14: 64 MiB, 67108864 bytes, 131072 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/ram15: 64 MiB, 67108864 bytes, 131072 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/loop0: 2 GiB, 2097152000 bytes, 4096000 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 /dev/sda: 2.7 TiB, 3000592982016 bytes, 5860533168 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
Disklabel type: gpt
Disk identifier: 60B4E04F-942D-4D1C-85FF-B23FE5128994

Device          Start        End    Sectors  Size Type
/dev/sda1        4096   16781311   16777216    8G Linux RAID
/dev/sda2    16781312   17829887    1048576  512M Linux RAID
/dev/sda3    17829888 2165313535 2147483648    1T Linux RAID
/dev/sda4  2165313536 5860533134 3695219599  1.7T Linux RAID
/dev/sda5        2048       4095       2048    1M BIOS boot

Partition table entries are not in disk order.
Disk /dev/sdb: 2.7 TiB, 3000592982016 bytes, 5860533168 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
Disklabel type: gpt
Disk identifier: 34C3C1CE-55FF-40E6-92E5-237952263F27

Device          Start        End    Sectors  Size Type
/dev/sdb1        4096   16781311   16777216    8G Linux RAID
/dev/sdb2    16781312   17829887    1048576  512M Linux RAID
/dev/sdb3    17829888 2165313535 2147483648    1T Linux RAID
/dev/sdb4  2165313536 5860533134 3695219599  1.7T Linux RAID
/dev/sdb5        2048       4095       2048    1M BIOS boot

Partition table entries are not in disk order.
Disk /dev/md0: 8 GiB, 8581545984 bytes, 16760832 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 /dev/md1: 511.4 MiB, 536281088 bytes, 1047424 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 /dev/md2: 1023.9 GiB, 1099377410048 bytes, 2147221504 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

我花了一整天时间解决这个问题。欢迎任何帮助。

相关内容