すべてのアレイを自動的に構築する
全ディスク及びパーティションをチェックし、アレイが見つかった場合はそのアレイを構築し「アレイを開始」します。環境について
以下のアレイを作成した環境でコマンドを実行しています。- RAID 0アレイを作成するコマンドの実行・作成したアレイの確認と利用
- RAID 1アレイを作成する基本的なコマンドの例・作成したアレイの確認と利用
- RAID 4アレイを作成する基本的なコマンドの例・作成したアレイの確認と利用
アレイ構築時の注意
「設定ファイル」に「ARRAY」の記述がないアレイを構築した場合、アレイに対し個別にオプションを指定することができません。例えば「ライトインテントビットマップ」を有効にし、「外部ビットマップ」でビットマップファイルを保存しているアレイは、ビットマップファイルの指定を行うことができません。
この場合、「ライトインテントビットマップ」が無効になります。
よく分からない場合は、この方法を用いず設定ファイルに「ARRAY」の記述を行ってアレイを構築したほうが良いでしょう。
設定ファイル
以下の「設定ファイル」を用意します。デフォルトの「設定ファイル」に記述してもよいですが、今回は別の「設定ファイル」を作成し、そちらに記述しました。
「設定ファイル」のファイル名は「/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
# This file was auto-generated on Wed, 23 Oct 2013 20: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
# This file was auto-generated on Wed, 23 Oct 2013 20:23:27 +0900
# by mkconf $Id$
DEVICE
「DEVICE」にはチェック対象とする物理ボリュームの一覧を記述します。今回すべてのディスク及びパーティションを対象とするので、コメントアウトしデフォルトの設定を適用しています。
ARRAY
「ARRAY」には構築対象とするアレイの情報を記述します。「ARRAY」が一つも記述されていない場合は、見つかったアレイすべてが構築対象になります。
ただし「AUTO」による影響を受けます。
AUTO
「AUTO」には、構築対象もしくは構築対象にしないアレイの条件を記述します。今回すべてのアレイを構築対象にするため、記述を行わずデフォルトの設定を適用しています。
コマンドの実行
設定ファイルを指定し、アレイを構築するコマンドを実行します。コマンドの実行
以下のコマンドを実行し、アレイを構築します。「設定ファイル」の指定は赤字の箇所です。
各オプションの説明は「設定ファイルからアレイを構築するコマンドの説明」を参考にしてください。
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 further assembly
mdadm: cannot open device /dev/sr1: No medium found
mdadm: no recogniseable superblock on /dev/sdf7
mdadm: no recogniseable superblock on /dev/sdf6
mdadm: no recogniseable superblock on /dev/sdf5
mdadm: no recogniseable superblock on /dev/sdf4
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: 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: 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: cannot open device /dev/sr0: No medium found
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 further assembly
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 further assembly
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 further assembly
mdadm: looking for devices for further assembly
mdadm: no recogniseable superblock on /dev/md125p1
mdadm: Cannot assemble mbr metadata on /dev/md/RAID0Array
mdadm: no recogniseable superblock on /dev/md126p1
mdadm: Cannot assemble mbr metadata on /dev/md/RAID1Array
mdadm: no recogniseable superblock on /dev/md/RAID4Array1
mdadm: Cannot assemble mbr metadata on /dev/md/RAID4Array
mdadm: cannot open device /dev/sr1: No medium found
mdadm: no recogniseable superblock on /dev/sdf7
mdadm: no recogniseable superblock on /dev/sdf6
mdadm: no recogniseable superblock on /dev/sdf5
mdadm: no recogniseable superblock on /dev/sdf4
mdadm: /dev/sdf3 is busy - skipping
mdadm: /dev/sdf2 is busy - skipping
mdadm: /dev/sdf1 is busy - skipping
mdadm: Cannot assemble mbr metadata on /dev/sdf
mdadm: no recogniseable superblock on /dev/sde7
mdadm: no recogniseable superblock on /dev/sde6
mdadm: no recogniseable superblock on /dev/sde5
mdadm: no recogniseable superblock on /dev/sde4
mdadm: /dev/sde3 is busy - skipping
mdadm: /dev/sde2 is busy - skipping
mdadm: /dev/sde1 is busy - skipping
mdadm: Cannot assemble mbr metadata on /dev/sde
mdadm: no recogniseable superblock on /dev/sdd7
mdadm: no recogniseable superblock on /dev/sdd6
mdadm: no recogniseable superblock on /dev/sdd5
mdadm: no recogniseable superblock on /dev/sdd4
mdadm: /dev/sdd3 is busy - skipping
mdadm: /dev/sdd2 is busy - skipping
mdadm: /dev/sdd1 is busy - skipping
mdadm: Cannot assemble mbr metadata on /dev/sdd
mdadm: no recogniseable superblock on /dev/sdc4
mdadm: Cannot assemble mbr metadata on /dev/sdc3
mdadm: Cannot assemble mbr metadata on /dev/sdc2
mdadm: no recogniseable superblock on /dev/sdc1
mdadm: Cannot assemble mbr metadata on /dev/sdc
mdadm: Cannot assemble mbr metadata on /dev/sdb4
mdadm: Cannot assemble mbr metadata on /dev/sdb3
mdadm: no recogniseable superblock on /dev/sdb2
mdadm: no recogniseable superblock on /dev/sdb1
mdadm: Cannot assemble mbr metadata on /dev/sdb
mdadm: no recogniseable superblock on /dev/sda5
mdadm: Cannot assemble mbr metadata on /dev/sda2
mdadm: no recogniseable superblock on /dev/sda1
mdadm: Cannot assemble mbr metadata on /dev/sda
mdadm: cannot open device /dev/sr0: No medium found
mdadm: looking for devices for further assembly
mdadm: cannot open device /dev/sr1: No medium found
mdadm: no recogniseable superblock on /dev/sdf7
mdadm: no recogniseable superblock on /dev/sdf6
mdadm: no recogniseable superblock on /dev/sdf5
mdadm: no recogniseable superblock on /dev/sdf4
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: 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: 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: cannot open device /dev/sr0: No medium found
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 further assembly
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 further assembly
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 further assembly
mdadm: looking for devices for further assembly
mdadm: no recogniseable superblock on /dev/md125p1
mdadm: Cannot assemble mbr metadata on /dev/md/RAID0Array
mdadm: no recogniseable superblock on /dev/md126p1
mdadm: Cannot assemble mbr metadata on /dev/md/RAID1Array
mdadm: no recogniseable superblock on /dev/md/RAID4Array1
mdadm: Cannot assemble mbr metadata on /dev/md/RAID4Array
mdadm: cannot open device /dev/sr1: No medium found
mdadm: no recogniseable superblock on /dev/sdf7
mdadm: no recogniseable superblock on /dev/sdf6
mdadm: no recogniseable superblock on /dev/sdf5
mdadm: no recogniseable superblock on /dev/sdf4
mdadm: /dev/sdf3 is busy - skipping
mdadm: /dev/sdf2 is busy - skipping
mdadm: /dev/sdf1 is busy - skipping
mdadm: Cannot assemble mbr metadata on /dev/sdf
mdadm: no recogniseable superblock on /dev/sde7
mdadm: no recogniseable superblock on /dev/sde6
mdadm: no recogniseable superblock on /dev/sde5
mdadm: no recogniseable superblock on /dev/sde4
mdadm: /dev/sde3 is busy - skipping
mdadm: /dev/sde2 is busy - skipping
mdadm: /dev/sde1 is busy - skipping
mdadm: Cannot assemble mbr metadata on /dev/sde
mdadm: no recogniseable superblock on /dev/sdd7
mdadm: no recogniseable superblock on /dev/sdd6
mdadm: no recogniseable superblock on /dev/sdd5
mdadm: no recogniseable superblock on /dev/sdd4
mdadm: /dev/sdd3 is busy - skipping
mdadm: /dev/sdd2 is busy - skipping
mdadm: /dev/sdd1 is busy - skipping
mdadm: Cannot assemble mbr metadata on /dev/sdd
mdadm: no recogniseable superblock on /dev/sdc4
mdadm: Cannot assemble mbr metadata on /dev/sdc3
mdadm: Cannot assemble mbr metadata on /dev/sdc2
mdadm: no recogniseable superblock on /dev/sdc1
mdadm: Cannot assemble mbr metadata on /dev/sdc
mdadm: Cannot assemble mbr metadata on /dev/sdb4
mdadm: Cannot assemble mbr metadata on /dev/sdb3
mdadm: no recogniseable superblock on /dev/sdb2
mdadm: no recogniseable superblock on /dev/sdb1
mdadm: Cannot assemble mbr metadata on /dev/sdb
mdadm: no recogniseable superblock on /dev/sda5
mdadm: Cannot assemble mbr metadata on /dev/sda2
mdadm: no recogniseable superblock on /dev/sda1
mdadm: Cannot assemble mbr metadata on /dev/sda
mdadm: cannot open device /dev/sr0: No medium found