我有一个在 Windows 下设置的 3 磁盘 RAID 5 阵列,我想使用 mdadm 在 Linux 中使用它。我以前做过一些基本的 fakeraid 操作,但这是使用 BIOS 中的 Intel Matrix Storage 实用程序设置的,它没有像我预期的那样工作。
这是我的磁盘设置:
/dev/sda - 32GB SSD, Windows boot drive.
/dev/sda1 - Windows system partition
/dev/sda2 - Windows C:, 29GB
/dev/sdb }
/dev/sdc } the RAID5 array: 3x500GB; contains one partition, a 1TB NTFS filesystem
/dev/sdd }
/dev/sde - 128GB SSD, Linux's drive
/dev/sde1 - /boot
/dev/sde2 - LVM PV
/dev/dm0 - /
/dev/dm1 - /home
/dev/dm2 - <swap>
所以我做的第一件事就是运行mdadm --assemble --scan
,结果如下:
mdadm: /dev/sdd is identified as a member of /dev/md/imsm0, slot -1.
mdadm: /dev/sdc is identified as a member of /dev/md/imsm0, slot -1.
mdadm: /dev/sdb is identified as a member of /dev/md/imsm0, slot -1.
mdadm: added /dev/sdc to /dev/md/imsm0 as -1
mdadm: added /dev/sdb to /dev/md/imsm0 as -1
mdadm: added /dev/sdd to /dev/md/imsm0 as -1
mdadm: Container /dev/md/imsm0 has been assembled with 3 drives
因此,它很好地找到了磁盘上的 IMSM 信息并组装了一个容器:
# mdadm --examine /dev/md/imsm0
/dev/md/imsm0:
Magic : Intel Raid ISM Cfg Sig.
Version : 1.2.02
Orig Family : ee19d190
Family : ee19d190
Generation : 0009ab28
UUID : ab31031b:2d9f8489:5d87a6c4:e87e3826
Checksum : f09a3edc correct
MPB Sectors : 2
Disks : 3
RAID Devices : 1
Disk00 Serial : 3PM1DZBD
State : active
Id : 00010000
Usable Size : 976768654 (465.76 GiB 500.11 GB)
[NMWVolume]:
UUID : c192a859:14874bab:06ca8af9:d3e8b52e
RAID Level : 5
Members : 3
This Slot : 0
Array Size : 1953536000 (931.52 GiB 1000.21 GB)
Per Dev Size : 976768264 (465.76 GiB 500.11 GB)
Sector Offset : 0
Num Stripes : 7631000
Chunk Size : 64 KiB
Reserved : 0
Migrate State : idle
Map State : normal
Dirty State : clean
Disk01 Serial : 3PM222TL
State : active
Id : 00020000
Usable Size : 976768654 (465.76 GiB 500.11 GB)
Disk02 Serial : 3PM22GFQ
State : active
Id : 00030000
Usable Size : 976768654 (465.76 GiB 500.11 GB)
它显示了 Raid5 卷,“NMWVolume”在那里,但我如何获取它?该容器设备对我没有任何作用。我无法从中读取任何内容,即fdisk /dev/md/imsm0
只是返回Unable to read /dev/md/imsm0
。
如果我尝试运行mdadm --create --verbose --level=5 --raid-devices=3 --chunk=64 --auto=mdp /dev/md0 /dev/sd[bcd]
我会收到以下错误:
mdadm: layout defaults to left-symmetric
mdadm: layout defaults to left-symmetric
mdadm: layout defaults to left-symmetric
mdadm: super1.x cannot open /dev/sdb: Device or resource busy
mdadm: not enough space after merge (0 < 0)
mdadm: device /dev/sdb not suitable for any style of array
/dev/sd[bcd]
用替换/dev/md/imsm0
会出现错误mdadm: not enough devices with space to create array.
。
我尝试停止该/dev/md/imsm0
阵列并使用 sd[bcd] 驱动器重新运行该mdadm --create
命令,结果显示:
mdadm: layout defaults to left-symmetric
mdadm: layout defaults to left-symmetric
mdadm: layout defaults to left-symmetric
mdadm: /dev/sdb appears to be part of a raid array:
level=container devices=0 ctime=Wed Dec 31 18:00:00 1969
mdadm: partition table exists on /dev/sdb but will be lost or
meaningless after creating array
mdadm: layout defaults to left-symmetric
mdadm: /dev/sdc appears to be part of a raid array:
level=container devices=0 ctime=Wed Dec 31 18:00:00 1969
mdadm: layout defaults to left-symmetric
mdadm: /dev/sdd appears to be part of a raid array:
level=container devices=0 ctime=Wed Dec 31 18:00:00 1969
mdadm: partition table exists on /dev/sdd but will be lost or
meaningless after creating array
mdadm: size set to 488385408K
Continue creating array? ^C
所以我不会这么做...
我没有主意了。我该如何组装这个阵列?
答案1
好吧,我真傻。我已经搞明白了。
mdadm --assemble --scan
运行查找并组装容器后,运行mdadm -I /dev/md/imsm0
组装容器内的数组。哎呀!
# mdadm --assemble --scan
mdadm: Container /dev/md/imsm0 has been assembled with 3 drives
# mdadm -I /dev/md/imsm0
mdadm: Started /dev/md/NMWVolume with 3 devices
# ls -l /dev/md*
brw-rw---- 1 root disk 9, 126 Jan 24 02:22 /dev/md126
brw-rw---- 1 root disk 259, 0 Jan 24 02:22 /dev/md126p1
brw-rw---- 1 root disk 9, 127 Jan 24 02:22 /dev/md127
/dev/md:
total 0
lrwxrwxrwx 1 root root 8 Jan 24 02:22 imsm0 -> ../md127
lrwxrwxrwx 1 root root 8 Jan 24 02:22 NMWVolume -> ../md126
/dev/md126p1
有我的 RAID5'd 1TB NTFS 卷。