mdadmでソフトウェアRAIDの構築メモ

このエントリーをはてなブックマークに追加

ディスク3枚を使って,ソフトウェアraid5を構築する.
まず,ディスク全体のパーティションを作成.以下をそれぞれsdc, sddでも行う.

# fdisk /dev/sdb

helpの表示
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition’s system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

既存パーティションの削除
Command (m for help): d
Selected partition 1

新しいパーティションの作成
Command (m for help): n
primary partitionを選択
Command action
e extended
p primary partition (1-4)
p
1を選択
Partition number (1-4): 1
あとはデフォルトのままenter, enter
First cylinder (1-60563, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-60563, default 60563):
Using default value 60563

作成したパーティションの確認
Command (m for help): p

Disk /dev/sdb: 500.1 GB, 500106780160 bytes
256 heads, 63 sectors/track, 60563 cylinders
Units = cylinders of 16128 * 512 = 8257536 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0×00000000

Device Boot Start End Blocks Id System
/dev/sdb1 1 60563 488380000+ 83 Linux

変更を反映して終了
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

raid5の構築

# mdadm -C /dev/md0 -l5 -n3 /dev/sd[bcd]1
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.

状態の確認

# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Fri Jul 15 00:34:46 2011
Rd Dev Size : 488378368 (465.75 GiB 500.10 GB)

Raid Devices : 3
Total Devices : 3
Persistence : Superblock is persistent
Update Time : Fri Jul 15 00:34:46 2011
State : clean, degraded, recovering
Active Devices : 2
Working Devices : 3
Failed Devices : 0
Spare Devices : 1
Layout : left-symmetric

Chunk Size : 512Kaid Level : raid5
Array Size : 976756736 (931.51 GiB 1000.20 GB)
Use

Rebuild Status : 0% complete

Name : kimson.name:0 (local to host kimson.name)
UUID : a2a033fe:98d2f0c3:148a607a:90f0b39c
Events : 1

Number Major Minor RaidDevice State
0 8 17 0 active sync /dev/sdb1
1 8 33 1 active sync /dev/sdc1
3 8 49 2 spare rebuilding /dev/sdd1

フォーマットする.今回はext4で.

# mkfs.ext4 /dev/md0
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=128 blocks, Stripe width=256 blocks
61054976 inodes, 244189184 blocks
12209459 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
7453 block groups
32768 blocks per group, 32768 fragments per group
8192 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

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

あとはマウントするだけ.

# mount /dev/md0 tmp

次は性能を測って,ZFSと比較する.

カテゴリー: 未分類   タグ: ,   この投稿のパーマリンク

コメントをどうぞ

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

*

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>