我想知道在现有服务器上设置软件 RAID 阵列的正确方法。我有两个全新的 3TB 磁盘用于阵列。
Specifically, I want to set up a 3TB RAID 1 array, formatted to ext4, not using LVM. But a more general answer might help others with instructions from start to finish.
I have tried a number of guides:
I also found these resources:
mdadm.conf and other stepsThe initial partitioning of the drives appears to be key; the last link above mentions this in detail, but the previous link seems to achieve the same result and is simpler.
Dav*_*rds 17
此答案假设您正在使用两个相同的新驱动器创建新的 RAID 1 阵列。文件系统将是占用整个驱动器的单个分区上的 ext4,不使用 LVM。
首先,通过运行确定新硬盘驱动器的设备名称sudo fdisk -l。就我而言,新驱动器是/dev/sdc和/dev/sdd。
然后在每个驱动器上创建分区。分区表需要是 GPT 才能允许使用 2TB 以上,所以不能使用fdisk.
运行parted /dev/sdc。
在(parted)提示符下,键入 来创建分区表mklabel gpt。
通过键入检查驱动器上的可用空间print free。就我而言,这显示 3001GB。
通过键入创建分区mkpart primary 1M 3001GB。这会以 1M 偏移量开始分区,给出 4096 字节对齐。这可能是必要的,也可能不是必要的,但如果不是,也不会受到伤害。
通过键入检查您的分区是否已设置p。然后输入q退出。
对 重复步骤 1 到 5 /dev/sdd。
现在使用以下mdadm命令创建数组:
sudo mdadm --verbose --create /dev/md0 --level=raid1 --raid-devices=2 /dev/sd[cd]1
Run Code Online (Sandbox Code Playgroud)
创建文件系统:
sudo mkfs.ext4 /dev/md0
Run Code Online (Sandbox Code Playgroud)
最后,将您的阵列安装在某处,/etc/fstab如果您希望它永久安装,请将其添加到。我这样做了:
通过运行创建一个安装阵列的位置sudo mkdir /mnt/md0。
编辑/etc/fstab并添加以下行:
/dev/md0 /mnt/md0 auto defaults 0 0
Run Code Online (Sandbox Code Playgroud)通过运行挂载sudo mount /mnt/md0。
现在您可以开始使用您的阵列了。但是请记住,在完全操作之前,它需要完成其初始同步。您可以通过运行跟踪其进度sudo mdadm --detail /dev/md0。
| 归档时间: |
|
| 查看次数: |
26499 次 |
| 最近记录: |