設定ファイルに構築するアレイを記述してアレイを構築する
「設定ファイル」に構築するアレイを記述してアレイを構築します。環境について
以下のアレイを作成した環境でコマンドを実行しています。- RAID 0アレイを作成するコマンドの実行・作成したアレイの確認と利用
- RAID 1アレイを作成する基本的なコマンドの例・作成したアレイの確認と利用
- RAID 4アレイを作成する基本的なコマンドの例・作成したアレイの確認と利用
設定ファイル
以下の「設定ファイル」を用意します。デフォルトの「設定ファイル」に記述してもよいのですが、今回は別の「設定ファイル」を作成し、そちらに記述しました。
「設定ファイル」のファイル名は「/home/ubuntu/myArray.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
# 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
ARRAY /dev/md/RAID4Array metadata=1.2 name=vb-ubuntu1310:RAID4Array UUID=159a014c:017a0dd1:c0b98cc0:12ddfdc4
ARRAY /dev/md/RAID1Array metadata=1.2 name=vb-ubuntu1310:RAID1Array UUID=dcc7f782:7dcd8d7a:59393ac2:0cd4b732
ARRAY /dev/md/RAID0Array metadata=1.2 name=vb-ubuntu1310:RAID0Array UUID=95af84ed:bbdbde85:8fbbac3b:fb6aaeb8
# This file was auto-generated on Wed, 23 Oct 2013 22:23:27 +0900
# by mkconf $Id$
#
# 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
# 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
ARRAY /dev/md/RAID4Array metadata=1.2 name=vb-ubuntu1310:RAID4Array UUID=159a014c:017a0dd1:c0b98cc0:12ddfdc4
ARRAY /dev/md/RAID1Array metadata=1.2 name=vb-ubuntu1310:RAID1Array UUID=dcc7f782:7dcd8d7a:59393ac2:0cd4b732
ARRAY /dev/md/RAID0Array metadata=1.2 name=vb-ubuntu1310:RAID0Array UUID=95af84ed:bbdbde85:8fbbac3b:fb6aaeb8
# This file was auto-generated on Wed, 23 Oct 2013 22:23:27 +0900
# by mkconf $Id$
DEVICE
「DEVICE」にはチェック対象とする物理ボリュームの一覧を記述します。今回すべてのディスク及びパーティションを対象とするので、コメントアウトしデフォルトの設定を適用しています。
ARRAY
「ARRAY」には構築対象とするアレイの情報を記述します。「ARRAY」に記述されていないアレイは構築されません。
ただし「DEVICE」による影響を受けます。
コマンドの実行
設定ファイルを指定し、アレイを構築するコマンドを実行します。コマンドの実行
以下のコマンドを実行し、アレイを構築します。「設定ファイル」の指定は赤字の箇所です。
各オプションの説明は「設定ファイルからアレイを構築するコマンドの説明」を参考にしてください。
sudo mdadm --assemble --scan --config=/home/ubuntu/myArray.conf
コマンドの実行結果
以下のように実行結果が表示されます。
ubuntu@vb-ubuntu1310:~$ sudo mdadm --assemble --scan --config=/home/ubuntu/myArray.conf
mdadm: /dev/md/RAID4Array has been started with 3 drives.
mdadm: /dev/md/RAID1Array has been started with 3 drives.
mdadm: /dev/md/RAID0Array has been started with 3 drives.
mdadm: /dev/md/RAID4Array has been started with 3 drives.
mdadm: /dev/md/RAID1Array has been started with 3 drives.
mdadm: /dev/md/RAID0Array has been started with 3 drives.
結果から以下のことが分かります。
- 「/dev/md/RAID4Array」が3つの物理ボリュームでアレイを構築しアレイを開始した
- 「/dev/md/RAID1Array」が3つの物理ボリュームでアレイを構築しアレイを開始した
- 「/dev/md/RAID0Array」が3つの物理ボリュームでアレイを構築しアレイを開始した
詳細情報の表示
「--verbose」オプションを追加すると、詳細情報が表示されます。以下のコマンドを実行します。
sudo mdadm --assemble --scan --config=/home/ubuntu/myArray.conf --verbose
以下のように実行結果が表示されます。
赤字の箇所は、アレイの構築に関する箇所です。
ubuntu@vb-ubuntu1310:~$ sudo mdadm --assemble --scan --config=/home/ubuntu/myArray.conf --verbose
mdadm: looking for devices for /dev/md/RAID4Array
mdadm: cannot open device /dev/sr1: No medium found
mdadm: no RAID superblock on /dev/sdf7
mdadm: no RAID superblock on /dev/sdf6
mdadm: no RAID superblock on /dev/sdf5
mdadm: no RAID superblock on /dev/sdf4
mdadm: /dev/sdf2 has wrong uuid.
mdadm: /dev/sdf1 has wrong uuid.
mdadm: no RAID superblock on /dev/sdf
mdadm: no RAID superblock on /dev/sde7
mdadm: no RAID superblock on /dev/sde6
mdadm: no RAID superblock on /dev/sde5
mdadm: no RAID superblock on /dev/sde4
mdadm: /dev/sde2 has wrong uuid.
mdadm: /dev/sde1 has wrong uuid.
mdadm: no RAID superblock on /dev/sde
mdadm: no RAID superblock on /dev/sdd7
mdadm: no RAID superblock on /dev/sdd6
mdadm: no RAID superblock on /dev/sdd5
mdadm: no RAID superblock on /dev/sdd4
mdadm: /dev/sdd2 has wrong uuid.
mdadm: /dev/sdd1 has wrong uuid.
mdadm: no RAID superblock on /dev/sdd
mdadm: no RAID superblock on /dev/sdc4
mdadm: no RAID superblock on /dev/sdc3
mdadm: no RAID superblock on /dev/sdc2
mdadm: no RAID superblock on /dev/sdc1
mdadm: no RAID superblock on /dev/sdc
mdadm: no RAID superblock on /dev/sdb4
mdadm: no RAID superblock on /dev/sdb3
mdadm: no RAID superblock on /dev/sdb2
mdadm: no RAID superblock on /dev/sdb1
mdadm: no RAID superblock on /dev/sdb
mdadm: no RAID superblock on /dev/sda5
mdadm: no RAID superblock on /dev/sda2
mdadm: no RAID superblock on /dev/sda1
mdadm: no RAID superblock on /dev/sda
mdadm: no RAID superblock on /dev/sr0
mdadm: /dev/sdf3 is identified as a member of /dev/md/RAID4Array, slot 2.
mdadm: /dev/sde3 is identified as a member of /dev/md/RAID4Array, slot 1.
mdadm: /dev/sdd3 is identified as a member of /dev/md/RAID4Array, slot 0.
mdadm: added /dev/sde3 to /dev/md/RAID4Array as 1
mdadm: added /dev/sdf3 to /dev/md/RAID4Array as 2
mdadm: added /dev/sdd3 to /dev/md/RAID4Array as 0
mdadm: /dev/md/RAID4Array has been started with 3 drives.
mdadm: looking for devices for /dev/md/RAID1Array
mdadm: no RAID superblock on /dev/md/RAID4Array
mdadm: cannot open device /dev/sr1: No medium found
mdadm: no RAID superblock on /dev/sdg7
mdadm: no RAID superblock on /dev/sdg6
mdadm: no RAID superblock on /dev/sdg5
mdadm: no RAID superblock on /dev/sdg4
mdadm: no RAID superblock on /dev/sdg3
mdadm: no RAID superblock on /dev/sdg2
mdadm: no RAID superblock on /dev/sdg1
mdadm: no RAID superblock on /dev/sdg
mdadm: no RAID superblock on /dev/sdf7
mdadm: no RAID superblock on /dev/sdf6
mdadm: no RAID superblock on /dev/sdf5
mdadm: no RAID superblock on /dev/sdf4
mdadm: /dev/sdf3 has wrong uuid.
mdadm: /dev/sdf1 has wrong uuid.
mdadm: no RAID superblock on /dev/sdf
mdadm: no RAID superblock on /dev/sde7
mdadm: no RAID superblock on /dev/sde6
mdadm: no RAID superblock on /dev/sde5
mdadm: no RAID superblock on /dev/sde4
mdadm: /dev/sde3 has wrong uuid.
mdadm: /dev/sde1 has wrong uuid.
mdadm: no RAID superblock on /dev/sde
mdadm: no RAID superblock on /dev/sdd7
mdadm: no RAID superblock on /dev/sdd6
mdadm: no RAID superblock on /dev/sdd5
mdadm: no RAID superblock on /dev/sdd4
mdadm: /dev/sdd3 has wrong uuid.
mdadm: /dev/sdd1 has wrong uuid.
mdadm: no RAID superblock on /dev/sdd
mdadm: no RAID superblock on /dev/sdc4
mdadm: no RAID superblock on /dev/sdc3
mdadm: no RAID superblock on /dev/sdc2
mdadm: no RAID superblock on /dev/sdc1
mdadm: no RAID superblock on /dev/sdc
mdadm: no RAID superblock on /dev/sdb4
mdadm: no RAID superblock on /dev/sdb3
mdadm: no RAID superblock on /dev/sdb2
mdadm: no RAID superblock on /dev/sdb1
mdadm: no RAID superblock on /dev/sdb
mdadm: no RAID superblock on /dev/sda5
mdadm: no RAID superblock on /dev/sda2
mdadm: no RAID superblock on /dev/sda1
mdadm: no RAID superblock on /dev/sda
mdadm: no RAID superblock on /dev/sr0
mdadm: /dev/sdf2 is identified as a member of /dev/md/RAID1Array, slot 2.
mdadm: /dev/sde2 is identified as a member of /dev/md/RAID1Array, slot 1.
mdadm: /dev/sdd2 is identified as a member of /dev/md/RAID1Array, slot 0.
mdadm: added /dev/sde2 to /dev/md/RAID1Array as 1
mdadm: added /dev/sdf2 to /dev/md/RAID1Array as 2
mdadm: added /dev/sdd2 to /dev/md/RAID1Array as 0
mdadm: /dev/md/RAID1Array has been started with 3 drives.
mdadm: looking for devices for /dev/md/RAID0Array
mdadm: no RAID superblock on /dev/md126p1
mdadm: no RAID superblock on /dev/md/RAID1Array
mdadm: no RAID superblock on /dev/md127p1
mdadm: no RAID superblock on /dev/md/RAID4Array
mdadm: cannot open device /dev/sr1: No medium found
mdadm: no RAID superblock on /dev/sdg7
mdadm: no RAID superblock on /dev/sdg6
mdadm: no RAID superblock on /dev/sdg5
mdadm: no RAID superblock on /dev/sdg4
mdadm: no RAID superblock on /dev/sdg3
mdadm: no RAID superblock on /dev/sdg2
mdadm: no RAID superblock on /dev/sdg1
mdadm: no RAID superblock on /dev/sdg
mdadm: no RAID superblock on /dev/sdf7
mdadm: no RAID superblock on /dev/sdf6
mdadm: no RAID superblock on /dev/sdf5
mdadm: no RAID superblock on /dev/sdf4
mdadm: /dev/sdf3 has wrong uuid.
mdadm: /dev/sdf2 has wrong uuid.
mdadm: no RAID superblock on /dev/sdf
mdadm: no RAID superblock on /dev/sde7
mdadm: no RAID superblock on /dev/sde6
mdadm: no RAID superblock on /dev/sde5
mdadm: no RAID superblock on /dev/sde4
mdadm: /dev/sde3 has wrong uuid.
mdadm: /dev/sde2 has wrong uuid.
mdadm: no RAID superblock on /dev/sde
mdadm: no RAID superblock on /dev/sdd7
mdadm: no RAID superblock on /dev/sdd6
mdadm: no RAID superblock on /dev/sdd5
mdadm: no RAID superblock on /dev/sdd4
mdadm: /dev/sdd3 has wrong uuid.
mdadm: /dev/sdd2 has wrong uuid.
mdadm: no RAID superblock on /dev/sdd
mdadm: no RAID superblock on /dev/sdc4
mdadm: no RAID superblock on /dev/sdc3
mdadm: no RAID superblock on /dev/sdc2
mdadm: no RAID superblock on /dev/sdc1
mdadm: no RAID superblock on /dev/sdc
mdadm: no RAID superblock on /dev/sdb4
mdadm: no RAID superblock on /dev/sdb3
mdadm: no RAID superblock on /dev/sdb2
mdadm: no RAID superblock on /dev/sdb1
mdadm: no RAID superblock on /dev/sdb
mdadm: no RAID superblock on /dev/sda5
mdadm: no RAID superblock on /dev/sda2
mdadm: no RAID superblock on /dev/sda1
mdadm: no RAID superblock on /dev/sda
mdadm: no RAID superblock on /dev/sr0
mdadm: /dev/sdf1 is identified as a member of /dev/md/RAID0Array, slot 2.
mdadm: /dev/sde1 is identified as a member of /dev/md/RAID0Array, slot 1.
mdadm: /dev/sdd1 is identified as a member of /dev/md/RAID0Array, slot 0.
mdadm: added /dev/sde1 to /dev/md/RAID0Array as 1
mdadm: added /dev/sdf1 to /dev/md/RAID0Array as 2
mdadm: added /dev/sdd1 to /dev/md/RAID0Array as 0
mdadm: /dev/md/RAID0Array has been started with 3 drives.
mdadm: looking for devices for /dev/md/RAID4Array
mdadm: cannot open device /dev/sr1: No medium found
mdadm: no RAID superblock on /dev/sdf7
mdadm: no RAID superblock on /dev/sdf6
mdadm: no RAID superblock on /dev/sdf5
mdadm: no RAID superblock on /dev/sdf4
mdadm: /dev/sdf2 has wrong uuid.
mdadm: /dev/sdf1 has wrong uuid.
mdadm: no RAID superblock on /dev/sdf
mdadm: no RAID superblock on /dev/sde7
mdadm: no RAID superblock on /dev/sde6
mdadm: no RAID superblock on /dev/sde5
mdadm: no RAID superblock on /dev/sde4
mdadm: /dev/sde2 has wrong uuid.
mdadm: /dev/sde1 has wrong uuid.
mdadm: no RAID superblock on /dev/sde
mdadm: no RAID superblock on /dev/sdd7
mdadm: no RAID superblock on /dev/sdd6
mdadm: no RAID superblock on /dev/sdd5
mdadm: no RAID superblock on /dev/sdd4
mdadm: /dev/sdd2 has wrong uuid.
mdadm: /dev/sdd1 has wrong uuid.
mdadm: no RAID superblock on /dev/sdd
mdadm: no RAID superblock on /dev/sdc4
mdadm: no RAID superblock on /dev/sdc3
mdadm: no RAID superblock on /dev/sdc2
mdadm: no RAID superblock on /dev/sdc1
mdadm: no RAID superblock on /dev/sdc
mdadm: no RAID superblock on /dev/sdb4
mdadm: no RAID superblock on /dev/sdb3
mdadm: no RAID superblock on /dev/sdb2
mdadm: no RAID superblock on /dev/sdb1
mdadm: no RAID superblock on /dev/sdb
mdadm: no RAID superblock on /dev/sda5
mdadm: no RAID superblock on /dev/sda2
mdadm: no RAID superblock on /dev/sda1
mdadm: no RAID superblock on /dev/sda
mdadm: no RAID superblock on /dev/sr0
mdadm: /dev/sdf3 is identified as a member of /dev/md/RAID4Array, slot 2.
mdadm: /dev/sde3 is identified as a member of /dev/md/RAID4Array, slot 1.
mdadm: /dev/sdd3 is identified as a member of /dev/md/RAID4Array, slot 0.
mdadm: added /dev/sde3 to /dev/md/RAID4Array as 1
mdadm: added /dev/sdf3 to /dev/md/RAID4Array as 2
mdadm: added /dev/sdd3 to /dev/md/RAID4Array as 0
mdadm: /dev/md/RAID4Array has been started with 3 drives.
mdadm: looking for devices for /dev/md/RAID1Array
mdadm: no RAID superblock on /dev/md/RAID4Array
mdadm: cannot open device /dev/sr1: No medium found
mdadm: no RAID superblock on /dev/sdg7
mdadm: no RAID superblock on /dev/sdg6
mdadm: no RAID superblock on /dev/sdg5
mdadm: no RAID superblock on /dev/sdg4
mdadm: no RAID superblock on /dev/sdg3
mdadm: no RAID superblock on /dev/sdg2
mdadm: no RAID superblock on /dev/sdg1
mdadm: no RAID superblock on /dev/sdg
mdadm: no RAID superblock on /dev/sdf7
mdadm: no RAID superblock on /dev/sdf6
mdadm: no RAID superblock on /dev/sdf5
mdadm: no RAID superblock on /dev/sdf4
mdadm: /dev/sdf3 has wrong uuid.
mdadm: /dev/sdf1 has wrong uuid.
mdadm: no RAID superblock on /dev/sdf
mdadm: no RAID superblock on /dev/sde7
mdadm: no RAID superblock on /dev/sde6
mdadm: no RAID superblock on /dev/sde5
mdadm: no RAID superblock on /dev/sde4
mdadm: /dev/sde3 has wrong uuid.
mdadm: /dev/sde1 has wrong uuid.
mdadm: no RAID superblock on /dev/sde
mdadm: no RAID superblock on /dev/sdd7
mdadm: no RAID superblock on /dev/sdd6
mdadm: no RAID superblock on /dev/sdd5
mdadm: no RAID superblock on /dev/sdd4
mdadm: /dev/sdd3 has wrong uuid.
mdadm: /dev/sdd1 has wrong uuid.
mdadm: no RAID superblock on /dev/sdd
mdadm: no RAID superblock on /dev/sdc4
mdadm: no RAID superblock on /dev/sdc3
mdadm: no RAID superblock on /dev/sdc2
mdadm: no RAID superblock on /dev/sdc1
mdadm: no RAID superblock on /dev/sdc
mdadm: no RAID superblock on /dev/sdb4
mdadm: no RAID superblock on /dev/sdb3
mdadm: no RAID superblock on /dev/sdb2
mdadm: no RAID superblock on /dev/sdb1
mdadm: no RAID superblock on /dev/sdb
mdadm: no RAID superblock on /dev/sda5
mdadm: no RAID superblock on /dev/sda2
mdadm: no RAID superblock on /dev/sda1
mdadm: no RAID superblock on /dev/sda
mdadm: no RAID superblock on /dev/sr0
mdadm: /dev/sdf2 is identified as a member of /dev/md/RAID1Array, slot 2.
mdadm: /dev/sde2 is identified as a member of /dev/md/RAID1Array, slot 1.
mdadm: /dev/sdd2 is identified as a member of /dev/md/RAID1Array, slot 0.
mdadm: added /dev/sde2 to /dev/md/RAID1Array as 1
mdadm: added /dev/sdf2 to /dev/md/RAID1Array as 2
mdadm: added /dev/sdd2 to /dev/md/RAID1Array as 0
mdadm: /dev/md/RAID1Array has been started with 3 drives.
mdadm: looking for devices for /dev/md/RAID0Array
mdadm: no RAID superblock on /dev/md126p1
mdadm: no RAID superblock on /dev/md/RAID1Array
mdadm: no RAID superblock on /dev/md127p1
mdadm: no RAID superblock on /dev/md/RAID4Array
mdadm: cannot open device /dev/sr1: No medium found
mdadm: no RAID superblock on /dev/sdg7
mdadm: no RAID superblock on /dev/sdg6
mdadm: no RAID superblock on /dev/sdg5
mdadm: no RAID superblock on /dev/sdg4
mdadm: no RAID superblock on /dev/sdg3
mdadm: no RAID superblock on /dev/sdg2
mdadm: no RAID superblock on /dev/sdg1
mdadm: no RAID superblock on /dev/sdg
mdadm: no RAID superblock on /dev/sdf7
mdadm: no RAID superblock on /dev/sdf6
mdadm: no RAID superblock on /dev/sdf5
mdadm: no RAID superblock on /dev/sdf4
mdadm: /dev/sdf3 has wrong uuid.
mdadm: /dev/sdf2 has wrong uuid.
mdadm: no RAID superblock on /dev/sdf
mdadm: no RAID superblock on /dev/sde7
mdadm: no RAID superblock on /dev/sde6
mdadm: no RAID superblock on /dev/sde5
mdadm: no RAID superblock on /dev/sde4
mdadm: /dev/sde3 has wrong uuid.
mdadm: /dev/sde2 has wrong uuid.
mdadm: no RAID superblock on /dev/sde
mdadm: no RAID superblock on /dev/sdd7
mdadm: no RAID superblock on /dev/sdd6
mdadm: no RAID superblock on /dev/sdd5
mdadm: no RAID superblock on /dev/sdd4
mdadm: /dev/sdd3 has wrong uuid.
mdadm: /dev/sdd2 has wrong uuid.
mdadm: no RAID superblock on /dev/sdd
mdadm: no RAID superblock on /dev/sdc4
mdadm: no RAID superblock on /dev/sdc3
mdadm: no RAID superblock on /dev/sdc2
mdadm: no RAID superblock on /dev/sdc1
mdadm: no RAID superblock on /dev/sdc
mdadm: no RAID superblock on /dev/sdb4
mdadm: no RAID superblock on /dev/sdb3
mdadm: no RAID superblock on /dev/sdb2
mdadm: no RAID superblock on /dev/sdb1
mdadm: no RAID superblock on /dev/sdb
mdadm: no RAID superblock on /dev/sda5
mdadm: no RAID superblock on /dev/sda2
mdadm: no RAID superblock on /dev/sda1
mdadm: no RAID superblock on /dev/sda
mdadm: no RAID superblock on /dev/sr0
mdadm: /dev/sdf1 is identified as a member of /dev/md/RAID0Array, slot 2.
mdadm: /dev/sde1 is identified as a member of /dev/md/RAID0Array, slot 1.
mdadm: /dev/sdd1 is identified as a member of /dev/md/RAID0Array, slot 0.
mdadm: added /dev/sde1 to /dev/md/RAID0Array as 1
mdadm: added /dev/sdf1 to /dev/md/RAID0Array as 2
mdadm: added /dev/sdd1 to /dev/md/RAID0Array as 0
mdadm: /dev/md/RAID0Array has been started with 3 drives.