Re: [Hampshire] Simple RAID problem

Top Page

Reply to this message
Author: Stuart Sears
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Simple RAID problem
Rob Malpass wrote:
> Hi all
>
> Trying to setup raid (on Ubuntu 8.1) with the command
>
> mdadm --assemble /dev/md0 /dev/sdb /dev/sdc
>
> and receiving the error no recognisable superblock on /dev/sdb
>
> The thing is I can mount both drives having formatted them to ext3
> previously.


mdadm --assemble is used to reconstruct an existing array, not create a
new one.

For that you want mdadm --create (or -C for those of us who dislike
typing for typing's sake)

what kind of RAID array are you trying to configure?
RAID 1 mirror?

Are you sure you used the entire disk in each case and not individual
partitions?

> I don't know what superblock means but I thought it meant that the
> drive's not formatted - which it obviously is if I can mount and
> read/write to it.


nope, it means that the drive has never been part of a RAID array, which
it won't have been unless you already set it up :)

> I must be doing something obvious wrong - but can't see what. To
> the best of my knowledge I've followed the guide at


** LONG-WINDED RAID INSTRUCTIONS **

Software RAID setup goes something like this:
(assuming you want a RAID 1 mirror set)
All of this is going to require root privileges, or lots of 'sudo'.

** 1. partition and label your disks
(yes, you can use the whole device, but personally I don't miss the 512b
I lose by creating a large partition on each disk. And I can actually
label a partition as 0xfd, Linux RAID autodetect, so that in a recovery
situation I know what it was used for...)

I'd use fdisk for this:

fdisk /dev/sdb

# then, at the unfriendly prompt.
m -> display the menu
p -> print the existing partition table (you'll use this a LOT)

n -> create new partition
p -> make it primary
1 -> choose which of the 4 primary partitions this will be.
you'll be prompted for start and length information. Usually just
hitting 'enter' at these prompts will give you the 1st available
cylinder and and endpoint at the end of the available space (i.e. fill
the disk)

p -> print your changes to be sure you're happy!

# optionally, relabel the partition to make it clear that it's for RAID:
t -> (the menu calls this changing System ID)
1 -> tell it to work with partition 1
fd -> tell it you want the label 0xfd (Linux RAID). hitting 'L' will
give you a list, so you don't need to remember it.

p -> check your changes again.

if you're happy, save the new partition table to disk:

w

you may also want to run 'partprobe /dev/sdb' afterwards, assuming
ubuntu has this installed by default, to refresh the kernel's cached
partition table and create the necessary files in /dev

This also means that you can ignore all the warnings about rebooting
that fdisk will throw at you.

** 1.5: rinse and repeat for /dev/sdc

** 2. create a RAID array using your newly partitioned disks

mdadm -C /dev/md0 -l 1 -n 2 /dev/sdb1 /dev/sdc1

this will create /dev/md0 (the first MD device, or raid 'meta-disk').

** 3. you then treat that as a normal partition and create a filesystem
on it.

mke2fs -j /dev/md0


I think you may have become slightly confused with the mdadm --assemble
commands in that howto.

man md / man mdadm
are both pretty good at explaining how some of this works.


Stuart

--
Stuart Sears RHCA etc.
"It's today!" said Piglet.
"My favourite day," said Pooh.