Help us understand the problem. What is going on with this article?

EC2のインスタンスが立ち上がってきた時にEphemeral Diskを束ねてRAID0にするスクリプト

More than 5 years have passed since last update.

EC2のインスタンスが立ち上がってきた時にEphemeral Diskを束ねてRAID0にするスクリプト - さよならインターネット

Ephemeral Diskが8本ある場合は条件を増やせば良い。

#!/bin/bash

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/aws/bin:/usr/local/bin

if [[ \`test -e /dev/xvdc ; echo \$?\` -eq 0 ]] ; then
    if [[ \`test -e /dev/xvde ; echo \$?\` -eq 0 ]] ; then

        # RAID用のファイルをつくる(ephemeral x4バージョン)
        umount /media/ephemeral0
        yes | mdadm --create /dev/md127 --level=0 --raid-devices=4 /dev/xvd[bcde]
        mkfs.ext4 /dev/md127
        mount /dev/md127 /media/ephemeral0
    else

        # RAID用のファイルをつくる(ephemeral x2バージョン)
        umount /media/ephemeral0
        yes | mdadm --create /dev/md127 --level=0 --raid-devices=2 /dev/xvd[bc]
        mkfs.ext4 /dev/md127
        mount /dev/md127 /media/ephemeral0
    fi
fi

このスクリプトをrc.localとか/etc/rc3.d/S~とかに置いておけば

起動時にRAID0として束ねて立ち上がってくれる。

このクールなアイデアは自分発のものではない

kenjiskywalker
インターネット初心者です。インターネットを勉強してます。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした