Jeremys Linux Blog | don't take this blog for gospel. I'm a linux newbie!

TAG | raid

Karmic Koala instructions for reassembling my RAID 5 software array on my Server after reinstalling the OS

I didn’t learn to do this by choice! I mucked up my video configuraiton and couldn’t boot into the gnome… after spending about 4 or 5 hours trying to fix it; I “bit the bullet” and reinstalled ubuntu.

1. I installed mdadm

sudo apt-get install mdadm

2. I (re) assembled the array

sudo mdadm –assemble /dev/md0 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1

3. I got the details of the array

sudo mdadm –detail –scan

Output on this occasion was as follows; do not copy and paste this directly – it will be a different UUID for future arrays I create

ARRAY /dev/md0 level=raid5 num-devices=6 metadata=00.90 UUID=58155936:66553965:01f9e43d:ac30fbff

I found out later that I needed to remove one of the zeroes from the metadata version… when I did a sudo mdadm -D it gave me an error for the version information.

ARRAY /dev/md0 level=raid5 num-devices=6 metadata=0.90 UUID=58155936:66553965:01f9e43d:ac30fbff

4. I copied and pasted the above line into mdadm.conf

sudo nano /etc/mdadm.conf

File now has the following entry:

# definitions of existing MD arrays

ARRAY /dev/md0 level=raid5 num-devices=6 metadata=0.90 UUID=58155936:66553965:01f9e43d:ac30fbff

5. I created somewhere for the array to be mounted

cd /mnt

sudo mkdir raid

6. I wanted the drive to be mounted automaticaly on startup

sudo nano /etc/fstab

7. I added the following line

/dev/md0                /mnt/raid                ext3                defaults                0                0

8. I mounted all arrays without rebooting

sudo mount -a

, , , , , , ,

Karmic Koala instructions for creating the RAID 5 Software array on my Server

Originaly found here http://www.jamierf.co.uk/2009/11/04/software-raid-5-using-mdadm-in-ubuntu-9-10/ but stored on my blog for reference incase their blog dies one day.

1. I installed mdadm

sudo apt-get install mdadm

2. I listed all the drives

sudo fdisk -l

3. I edited each drive that was to be part of the array, for me my system drive and spare drive was /dev/sdg and /dev/sdh respectively

sudo fdisk /dev/sda (but I also did this for the other drives in the array) /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf

4. I edited each drive that was to be part of the array, for me my system drive and spare drive was /dev/sdg and /dev/sdh respectively so obviously I didn’t touch them

n (for new drive)

p (for primary partition

1 (for partition 1)

enter (to select first cylinder

enter (to select last cylinder)

t (to set disk type)

1 (for partition 1)

fd (for Linux Raid Autodetect)

w (to write changes to disk)

5. I created the array

sudo mdadm –create –verbose /dev/md0 –level=5 –raid-devices=6 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1

6. I watched the progress

sudo mdadm -D /dev/md0

7. I got the details of the array

sudo mdadm –detail –scan

Output on this occasion was as follows; do not copy and paste this directly – it will be a different UUID for future arrays I create

ARRAY /dev/md0 level=raid5 num-devices=6 metadata=00.90 UUID=58155936:66553965:01f9e43d:ac30fbff

found out later that I needed to remove one of the zeroes from the metadata version… when I did a sudo mdadm -D it gave me an error for the version information.

ARRAY /dev/md0 level=raid5 num-devices=6 metadata=0.90 UUID=58155936:66553965:01f9e43d:ac30fbff

8. I copied and pasted the above line into mdadm.conf

sudo nano /etc/mdadm.conf

File now has the following entry:

# definitions of existing MD arrays

ARRAY /dev/md0 level=raid5 num-devices=6 metadata=0.90 UUID=58155936:66553965:01f9e43d:ac30fbff

9. I created the file system

sudo mkfs.ext3 /dev/md0

10. I removed the default 5% reserved space from the drive

sudo tune2fs -m 0 /dev/md0

11. I created somewhere for the array to be mounted

cd /mnt

sudo mkdir raid

12. I wanted the drive to be mounted automaticaly on startup

sudo nano /etc/fstab

13. I added the following line

/dev/md0                /mnt/raid                ext3                defaults                0                0

14. I mounted all arrays without rebooting

sudo mount -a

sudo fdisk -l

, , , ,

Find it!

Theme Design by devolux.org