I am new to sysadmin.
I am trying to launch a EBS-backed EC2 instance.
I did the following based on mongodb docs:
sudo mdadm --verbose --create /dev/md0 --level=10 --chunk=256 --raid-devices=1 /dev/xvdh1 echo 'DEVICE /dev/xvdh1' | sudo tee -a /etc/mdadm.conf sudo mdadm --detail --scan | sudo tee -a /etc/mdadm.conf sudo blockdev --setra 128 /dev/md0 sudo blockdev --setra 128 /dev/xvdh1 sudo dd if=/dev/zero of=/dev/md0 bs=512 count=1 sudo pvcreate /dev/md0 sudo vgcreate vg0 /dev/md0 sudo lvcreate -l 90%vg -n data vg0 sudo mke2fs -t ext4 -F /dev/vg0/data sudo mkdir /data echo '/dev/vg0/data /data ext4 defaults,auto,noatime,noexec 0 0' | sudo tee -a /etc/fstab sudo mount /data
Now I terminated EC2 instance and trying to re-mount the EBS-vols to newly launched instance.
What I was not sure:
- which of the above steps I need to do?
- Which of the above steps I can skip?
- Which of the above steps I SHOULD NOT DO at all ?(which can make things inconsistent)
On the new EC2 instace, I tried to execute the following cmd but then aborted due to warning.
I was not sure
sudo mdadm --verbose --create /dev/md0 --level=10 --chunk=256 --raid-devices=1 /dev/xvdh1 mdadm: layout defaults to n2 mdadm: layout defaults to n2 mdadm: /dev/xvdh1 appears to be part of a raid array: level=raid10 devices=5 ctime=Fri Jul 26 18:01:23 2013
After going thru warning/errors while executing, I skipped following steps and re-mounted:
sudo pvcreate /dev/md0 sudo vgcreate vg0 /dev/md0 sudo lvcreate -l 90%vg -n data vg0
but all the data in EBS vol is lost.
If somebody could verify, that would be great help.