2

I'm experimenting with creating a software RAID 0 device from 4 EBS volumes on Ubuntu 9.10 running at Amazon AWS following this guide:

http://alestic.com/2009/06/ec2-ebs-raid

The device appears (and according to SysBench is 3.5x faster than a regular attached EBS volume).

Problem is, when I reboot the instance, all files on the RAID device are gone. The device is available and mounted where expected, but contains no files. I am able to write new files to it, which survive until the next reboot.

EDIT:

Here's the script I use to setup the RAID. It writes to /etc/fstab and /etc/mdadm.conf

#!/bin/bash
# Create RAID 

volumes=4
devices="/dev/sdj /dev/sdk /dev/sdl /dev/sdm"
devicearray=($devices)
volumeids="vol-11111111 vol-22222222 vol-33333333 vol-44444444"

yes | sudo mdadm          \
  --create /dev/md0       \
  --level 0               \
  --metadata=1.1          \
  --raid-devices $volumes \
  $devices

echo DEVICE $devices | sudo tee /etc/mdadm.conf 
sudo mdadm --detail --scan | sudo tee -a /etc/mdadm.conf
sudo mkfs.xfs /dev/md0

mountpoint=/mnt/raid
echo "/dev/md0 $mountpoint xfs noatime 0 0" | sudo tee -a /etc/fstab
sudo mkdir $mountpoint
sudo mount $mountpoint

/etc/fstab

# /etc/fstab: static file system information.
# <file system>                                 <mount point>   <type>  <options>       <dump>  <pass>
proc                                            /proc           proc    defaults        0       0
/dev/sda1                                       /               ext3    defaults        0       0
/dev/sdb                                        /mnt            ext3    defaults        0       0
/dev/md0 /mnt/raid xfs noatime 0 0

/etc/mdadm.conf

DEVICE /dev/sdj /dev/sdk /dev/sdl /dev/sdm
ARRAY /dev/md0 level=raid0 num-devices=4 metadata=01.01 name=ip-10-194-5-235:0 UUID=67392a94:553fddec:4bc8e5c7:8d25c3ca
Eric J.
  • 772
  • 2
  • 14
  • 28

3 Answers3

2

It seems that extra white space after the device name in mdadm caused the issue. Editing away extra white space and repeating the procedure resolved the problem.

Eric J.
  • 772
  • 2
  • 14
  • 28
0

Add rw you fstab line. Like this, /dev/md0 /mnt xfs rw,noatime 0 0

0

I know this question is really old but I want to help those who will stumble on this just like I did. I was facing the exact same problem and ended up doing 4 things to make my RAID0 survive reboots(Ubuntu 12.04).

1) Entry in the /etc/fstab file: /dev/md0 /mnt/md0 auto defaults,nobootwait,comment=cloudconfig 0 2

2) echo 'DEVICE /dev/sdb /dev/sdc' > /etc/mdadm/mdadm.conf,

3) mdadm --detail --scan >> /etc/mdadm.conf

4) sudo update-initramfs -u

With this I was able to handle several reboots of my machine and RAID0 came up every time. Hope this helps.

APZ
  • 954
  • 2
  • 12
  • 25