Ubuntu Server 14.04 - 用 mdadm 创建的 RAID5 在重启后消失

use*_*354 5 reboot raid-5 mdadm ubuntu-server ubuntu-14.04

这是我关于超级用户的第一个问题,所以如果我忘记提及某事,请询问。

我正在尝试设置将用作文件服务器和媒体服务器的家庭服务器。我安装了 Ubuntu Server 14.04,现在我正在尝试使用 mdadm 设置由总共 5 个磁盘组成的 Raid5。创建raid后,我可以使用它,也可以从其他PC访问Raid。重新启动服务器后,Raid 不再出现。我也无法组装突袭。

我已经完成了以下步骤:

创建 RAID

mdadm --create --verbose /dev/md0 --level=5 --raid-devices=5 /dev/sda /dev/sdc /dev/sdd /dev/sde /dev/sdf
Run Code Online (Sandbox Code Playgroud)

RAID 完成后 ( watch cat /proc/mdstat),我存储 RAID 配置

mdadm --detail --scan >> /etc/mdadm/mdadm.conf
Run Code Online (Sandbox Code Playgroud)

然后我删除了 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
#DEVICE partitions

# 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

# This file was auto-generated on Fri, 14 Mar 2014 23:38:10 +0100
# by mkconf $Id$
ARRAY /dev/md0 UUID=b73a8b66:0681239e:2c1dd406:4907f892
Run Code Online (Sandbox Code Playgroud)

检查 RAID 是否正常工作 ( mdadm --detail /dev/md0) 返回以下信息:

/dev/md0:
Version : 1.2
Creation Time : Sat Apr 19 15:49:03 2014
Raid Level : raid5
Array Size : 7813531648 (7451.56 GiB 8001.06 GB)
Used Dev Size : 1953382912 (1862.89 GiB 2000.26 GB)
Raid Devices : 5
Total Devices : 5
Persistence : Superblock is persistent

Update Time : Sat Apr 19 22:13:37 2014
State : clean
Active Devices : 5
Working Devices : 5
Failed Devices : 0
Spare Devices : 0

Layout : left-symmetric
Chunk Size : 512K

Name : roembelHomeserver:0  (local to host roembelHomeserver)
UUID : c29ca6ea:951be1e7:ee0911e9:32b215c8
Events : 67

Number   Major   Minor   RaidDevice State
0       8        0        0      active sync   /dev/sda
1       8       32        1      active sync   /dev/sdc
2       8       48        2      active sync   /dev/sdd
3       8       64        3      active sync   /dev/sde
5       8       80        4      active sync   /dev/sdf
Run Code Online (Sandbox Code Playgroud)

据我所知,这一切看起来都不错。在下一步中,我创建了文件系统:

mke2fs -t ext4 /dev/md0
Run Code Online (Sandbox Code Playgroud)

这导致以下输出:

mke2fs 1.42.8 (20-Jun-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=128 blocks, Stripe width=512 blocks
244174848 inodes, 1953382912 blocks
97669145 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
59613 block groups
32768 blocks per group, 32768 fragments per group
4096 inodes per group
Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
    4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
    102400000, 214990848, 512000000, 550731776, 644972544, 1934917632

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
Run Code Online (Sandbox Code Playgroud)

然后我通过在文件末尾添加以下条目更改为 fstab:

/dev/md0    /data    ext4    defaults,nobootwait,no fail     0    2
Run Code Online (Sandbox Code Playgroud)

安装 RAID ( mount -a) 后,我可以使用它、创建文件、从其他 PC 访问它...

现在问题来了:
重新启动服务器 ( reboot now) 后,RAID 不再存在,即
- 没有 /dev/md0
- 空 /proc/mdstat(除了 Personalities)
- df -h 不显示 raid
- mdadm - assemble --scan 不做任何事情

有没有人有什么建议?我做错什么了吗?

MrP*_*ead 3

听起来您好像忘记了一步 - 告诉 initramfs 在启动时加载您的阵列。您的所有步骤都是正确的并且按时间顺序排列,但听起来您错过了最后一步。但鉴于我不知道您的服务器当前状态是什么,我建议您尝试以下操作:

启动并输入

mdadm --detail --scan
Run Code Online (Sandbox Code Playgroud)

你看到什么了吗?如果是这样,您的阵列就在那里并且应该可以工作(即下面的解决方案可能不会有帮助)。我猜当你重新启动时,你根本看不到你的 RAID 驱动器。如果这是真的,

确保 MDADM 守护进程正在运行ps aux | grep mdadm

这将显示是否有任何 MDADM 进程正在运行(如果没有看到结果,请启动 MDADM)

  1. 确保阵列已安装mount -a

  2. 更新 initramfsupdate-initramfs -u

  3. 验证 MDADM 未运行同步或重建 watch cat /proc/mdstat

如果有任何处理,先让它完成,以免搞砸阵列

重启并测试