ML115セットアップ

とりあえずファイルサーバを構築すべくCentOSの5.1をインストール。

# yum -y update

としてパッケージをアップデートしました。

んでファイルサーバにするために購入した500G x 2 のHDDを
ソフトウェアRAIDにしていこうと思いまっす。

まあ2つなのでなんの捻りもなくミラーにします。

まずは一個目のディスクをフォーマット


# fdisk /dev/sdb

The number of cylinders for this disk is set to 60801.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): n
Command action
e extended
p primary partition (1-4)

p

Partition number (1-4): 1
First cylinder (1-60801, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-60801, default 60801):
Using default value 60801

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
SCSI device sdb: 976773168 512-byte hdwr sectors (500108 MB)
sdb: Write Protect is off
SCSI device sdb: drive cache: write back
SCSI device sdb: 976773168 512-byte hdwr sectors (500108 MB)
sdb: Write Protect is off
SCSI device sdb: drive cache: write back
Syncing disks.

続いて2つ目

# fdisk /dev/sdc


# fdisk /dev/sdb

The number of cylinders for this disk is set to 60801.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): n
Command action
e extended
p primary partition (1-4)

p

Partition number (1-4): 1
First cylinder (1-60801, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-60801, default 60801):
Using default value 60801

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
SCSI device sdb: 976773168 512-byte hdwr sectors (500108 MB)
sdb: Write Protect is off
SCSI device sdb: drive cache: write back
SCSI device sdb: 976773168 512-byte hdwr sectors (500108 MB)
sdb: Write Protect is off
SCSI device sdb: drive cache: write back
Syncing disks.

そして、おもむろにRaidバイスファイルを作ります。
お名前は/dev/md0 Mirror Diskの略ですかね。


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

mdadmソフトウェアRaidを管理するためのコマンドらしいです。

ふむ。

Raidの状態は /proc/mdstatで確認できるみたい。


# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdc1[1] sdb1[0]
488383936 blocks [2/2] [UU]
[=>...................] resync = 6.3% (30961408/488383936) finish=78.6min speed=96982K/sec

unused devices:

sync中ですね。(`・ω・´)

次は作ったRaidバイスファイルシステムを作ります。


mkfs -j /dev/md0

これで使えるようになりましたかね。
マウントしてみます。

まずはマウントするためのディレクトリを作成

mkdir /mirror

んでマウントしてみると

mount -t ext3 /dev/md0 /mirror

てな具合ですね。

最後に再起動後もマウントするように仕込みます。

/etc/mdadm.confに以下の様に記述


DEVICE /dev/sd[bc]1
ARRAY /dev/md0 devices=/dev/sdb1,/dev/sdc1

/etc/fstabに以下の様に記述


/dev/md0 /mirror ext3 defaults 0 0

マウントしてますね


df -h

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
71G 1.5G 66G 3% /
/dev/sda1 99M 18M 77M 19% /boot
tmpfs 760M 0 760M 0% /dev/shm
/dev/md0 459G 199M 435G 1% /mirror