LoginSignup
1
1

More than 5 years have passed since last update.

ストライプボリュームの作り方 on AWS

Posted at

RHEL6の場合の手順です。

インスタンス起動時の注意

EBS最適化オプションを使ってインスタンスを起動し、EBS用のトラフィックを安定化させることが望ましい。但し別途料金はかかります。

EBS最適化が利用可能な場合はマネジメントコンソールで以下の赤枠にあるようなチェックボックスが表示される。

EBSOptimized.png

ストライピング用のボリュームの作成

マネジメントコンソール上で、ボリュームを作成する。たいした注意点はありませんが、このVolumeをAttachするインスタンスと同じゾーンに作成する、適切なIOPSを指定する点に気をつけます。

CreateVolume.png

ボリュームのEC2インスタンスへのAttach

Attachしたいインスタンスを指定するとともに割り当てるDeviceを指定します。

/dev/sdfと指定したものは実際にはインスタンス内部では/dev/xvdfになります。

AttachVolume.png

PVの作成

sudo pvcreate /dev/xvdf
sudo pvcreate /dev/xvdg
...(ストライプする分だけ作る)

以下のようなログが表示されればOKです。

Physical volume "/dev/xvdf" successfully created
Physical volume "/dev/xvdg" successfully created

VolumeGroupの作成

最初の引数にVolumeGroup名、それ以降の引数にグループ化するPVのデバイスパスを指定。複数本を束ねる場合は全部を引数に入れる

sudo vgcreate MyVolumeGroup1 /dev/xvdf /dev/xvdg 

以下のようなログが表示されます。

Volume group "MyVolumeGroup1" successfully created

ここまでうまく行ってるか確かめるには以下を実施

sudo vgdisplay -v MyVolumeGroup1

論理ボリュームの作成

sudo lvcreate -i ストライプする本数 -l 100%free -n MyLogicalVolume1 MyVolumeGroup1

以下のようなログが表示されます。

Using default stripesize 64.00 KiB
  Logical volume "MyLogicalVolume1" created

ファイルシステム作成

sudo mkfs.ext3 /dev/MyVolumeGroup1/MyLogicalVolume1

以下のようなログが表示されます。

mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=16 blocks, Stripe width=32 blocks
131072000 inodes, 524285952 blocks
26214297 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
16000 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, 512000000

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

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

マウント

sudo mkdir -p /mnt↲
sudo mount /dev/MyVolumeGroup1/MyLogicalVolume1 /mnt

最後にdfコマンドで確認してみましょう。無事マウントできているのが分かります。

df -m
Filesystem           1M-blocks  Used Available Use% Mounted on
/dev/xvda1               10080  1987      7581  21% /
tmpfs                     7442     0      7442   0% /dev/shm
/dev/mapper/MyVolumeGroup1-MyLogicalVolume1
                       2015858   199   1913260   1% /mnt
1
1
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
1
1