0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

デバイス追加~RAID1を構成するの手順(mdadm)

Posted at

デバイス追加~RAID1を構成するの手順

現在のディスクを確認

ls /dev | grep sd

仮想ディスクを2つ追加。構成システムを確認。

df -h

追加されたディスクを確認

ls /dev | grep sd

mdadmをインストール

apt -y install mdadm

RAID1を構築

mdadm --create /dev/md0 --level=raid1 --raid-devices=2 /dev/sdb1 /dev/sdc1

状態確認 ( [UU]となっていればOK )

cat /proc/mdstat

ディスクのサイズが大きくなればなるほど時間がかかります
[_U]から[UU]に変化すれば構築完了です

Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] 
md0 : active raid1 sda1[2] sdb1[1]
      20952064 blocks super 1.2 [2/1] [_U]
      [>....................]  recovery =  3.8% (801536/20952064) finish=1.2min speed=267178K/sec

Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] 
md0 : active raid1 sda1[2] sdb1[1]
      20952064 blocks super 1.2 [2/1] [_U]
      [======>..............]  recovery = 30.1% (6325632/20952064) finish=1.1min speed=204052K/sec

Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] 
md0 : active raid1 sda1[2] sdb1[1]
      20952064 blocks super 1.2 [2/2] [UU]

再起動するとデバイス名が変更されることがある。それを回避するためにデバイス名の定義を設定ファイルに追加する。

sudo mdadm --detail --scan

出力される結果を/etc/mdadm/mdadm.confに貼り付ける。
情報を更新

sudo update-initramfs -u

OS再起動

sudo reboot

現在利用できるブロックデバイスを一覧表示する

lsblk
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?