如何在两个可用驱动器的情况下重新组装 mdadm 阵列?

如何在两个可用驱动器的情况下重新组装 mdadm 阵列?

我需要重新设置 RAID 1(镜像)阵列。我有两个驱动器,mdadm 告诉我有关它们的以下信息:

$ sudo mdadm --examine /dev/sdb1
[sudo] password for pi: 
/dev/sdb1:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x1
     Array UUID : c3178bbd:a7547105:dca0fc2a:4c137310
           Name : raspi:0
  Creation Time : Sun Feb 16 09:29:07 2020
     Raid Level : raid1
   Raid Devices : 2

 Avail Dev Size : 240218112 (114.54 GiB 122.99 GB)
     Array Size : 120109056 (114.54 GiB 122.99 GB)
    Data Offset : 133120 sectors
   Super Offset : 8 sectors
   Unused Space : before=133040 sectors, after=0 sectors
          State : clean
    Device UUID : 012f89b4:c8b76c0e:8ae8fb78:52cc8175

Internal Bitmap : 8 sectors from superblock
    Update Time : Fri Jul 17 22:20:33 2020
  Bad Block Log : 512 entries available at offset 16 sectors
       Checksum : a3b8e3db - correct
         Events : 20895


   Device Role : Active device 1
   Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
[pi@alarm ~]$ sudo mdadm --examine /dev/sda1
/dev/sda1:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x1
     Array UUID : c3178bbd:a7547105:dca0fc2a:4c137310
           Name : raspi:0
  Creation Time : Sun Feb 16 09:29:07 2020
     Raid Level : raid1
   Raid Devices : 2

 Avail Dev Size : 240218112 (114.54 GiB 122.99 GB)
     Array Size : 120109056 (114.54 GiB 122.99 GB)
    Data Offset : 133120 sectors
   Super Offset : 8 sectors
   Unused Space : before=133040 sectors, after=0 sectors
          State : clean
    Device UUID : baef96f5:8750ba2b:892f40a7:3ecc2b38

Internal Bitmap : 8 sectors from superblock
    Update Time : Fri Jul 17 22:20:33 2020
  Bad Block Log : 512 entries available at offset 16 sectors
       Checksum : f302843f - correct
         Events : 20895


   Device Role : Active device 0
   Array State : AA ('A' == active, '.' == missing, 'R' == replacing)

如何重新创建阵列以安装 /dev/md0 (?) 并访问驱动器上的所有文件?AA即使当前没有数组,数组状态也会显示:

$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    1 119.3G  0 disk 
`-sda1        8:1    1 114.6G  0 part 
sdb           8:16   1 114.6G  0 disk 
`-sdb1        8:17   1 114.6G  0 part 
mmcblk0     179:0    0  29.8G  0 disk 
|-mmcblk0p1 179:1    0   121M  0 part /boot
`-mmcblk0p2 179:2    0  29.7G  0 part /

哦还有:

$ cat /proc/mdstat 
Personalities : 
unused devices: <none>

呼叫时哪个设备是活动设备 0 和 1 mdadm --create

更新

sudo mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1给我:

$ sudo mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1
[sudo] password for pi: 
mdadm: /dev/sda1 is busy - skipping
mdadm: /dev/sdb1 is busy - skipping

看起来好像什么也没发生,但这表明确实发生了一些事情:

$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda           8:0    1 119.3G  0 disk  
`-sda1        8:1    1 114.6G  0 part  
  `-md0       9:0    0 114.6G  0 raid1 
sdb           8:16   1 114.6G  0 disk  
`-sdb1        8:17   1 114.6G  0 part  
  `-md0       9:0    0 114.6G  0 raid1 
mmcblk0     179:0    0  29.8G  0 disk  
|-mmcblk0p1 179:1    0   121M  0 part  /boot
`-mmcblk0p2 179:2    0  29.7G  0 part  /
$ cat /proc/mdstat               
Personalities : [raid1] 
md0 : active raid1 sdb1[1] sda1[2]
      120109056 blocks super 1.2 [2/2] [UU]
      bitmap: 0/1 pages [0KB], 65536KB chunk

unused devices: <none>

我能够成功安装我的阵列/dev/md0

我执行的目的sudo mdadm --detail --scan | sudo tee -a /etc/mdadm.conf是为了将当前的数组配置存储到我的 mdadm.conf 文件中

答案1

mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1

设备根据创建顺序获取索引,它纯粹是序数

相关内容