Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Raid with mdadm



Hello:

I have my two RAID-1 arrays up and working now.  The authors of mdadm
say you can use the old tools (raidstart, raidstop, etc.) or the new
(all command line variations of mdadm), it is your choice to make.  For
my second array, I eventually figured out the mdadm way, and here are
the notes.

# To check the states at any time:
> cat /proc/mdstat
> mdadm --detail /dev/md1

# Moving all data is SERIOUS business (meaning I have to pay lots
# more attention, so I go into single user mode which kills
# lots of daemon processes.  From a console screen:
> /etc/init.d/single      [Debian distribution]

# Create an array with just one disk, call all others "missing".
# The disk should be smallest of the group.  If not, use parted.
> mdadm --create --verbose /dev/md1 --level=1 n 2 /dev/hdc5 missing

# Create your favorite filing system (presumably something that does
# journaling since you are conservative enough to do RAID).
# This is done on the md1 device.
> mke2fd -j -c /dev/md1

# Mount and put data onto md1.
> mount /dev/md1 /mnt
> cd /var        [whatever the based directory is]
> tar cf . - | (cd /mnt; tar xpf -)

# Get the system to use RAID.
> emacs /etc/fstab
  change device and file system.  /dev/hda5 -> /dev/md1, ext3 -> fd

# Reboot, check the system has mounted md1
# If OK, get other disks ready for the array.
> fdisk /dev/hda
t [type] 5 [partition] fd [auto-detect] w [write]

# Reboot so OS learns of hda's new partition type.
# Check everything is still OK.
# Add the new disk.
> mdadm /dev/md1 --add /dev/hda5

# Check on the progress.
> cat /proc/mdstat

This is on the order of a dozen commands to get RAID-1 working.  This
mirroring with a daemon paying attention is a great idea.  When I get
the email that one of those disks has failed, I'll first run my data
backup program and powerdown.  Then I get on my bike and buy a new
disk.  Connect the new hardward and powerup.  The command 
"mdadm /dev/md1 --add /dev/hda5" will restore the mirror.

I'm not going to worry about disk failures anymore.  I got a plan.


doug


A side topic.  I realized that I could have made my RAID system with
Reiser instead of ext3.  One potential advantage I heard about a
Reiser files system is that it handles directories with many files in
it better.  First, is that true?  Second, what number of files does
that start to make a difference?  As always, feel free to ramble
passionately on a tangent.




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org