Koozali.org: home of the SME Server

Adding an existing RAID5 to a SME 7 HOWTO

paquerette

Adding an existing RAID5 to a SME 7 HOWTO
« on: June 30, 2006, 09:30:29 PM »
Hi,

You're willing to add an existing raid 5(or create it, see the bottom of this message) array to a fresh installed sme server 7 ?

(note : i guess it can be easily adapted for other raid level)

Here is how I did it. I still have some errors at startup but the array is functionnal.
I believe the errors root's is my motherboard which seems to have some issues with IRQ handling.

So If you test this howto whitout the errors discribed on page 2 of this post, let me know.

my purpose :

Separate the system from the data because :

1/ SME Server is really fast to reinstall, its configuration can be written on the back of an envelope.
2/ Reinstalling the SME needs to erase all drives, and I don't want to lose my 688GB potentially written on the raid array
3/ I often tries different system, because I'm curious so I care about not to  have to delete all data on the Raid (back it up is cumbersome).
4/ I did have an existing RAID 5 array with a lot of data on it, but a first SME installation try has errased it. Fortunately, I made a backup Cumbersome : more than 350GB to save on many windows disk : that is precisely what I want to avoid


Starting point :
So I've a SME server 7 installed and working... with an unassembled raid 5 array with data on it and its drives unplugged.

I've done the installation without the drives involved in the RAID 5 I want to mount into the sme.

WARNING :If the drives are plugged while installing the SME, the content is errased and a small partition is created for raid1 mirroring /boot

Here is my configuration :
Code: [Select]

/dev/hda : system, 120Gb

/dev/sda |
/dev/sdb |
/dev/sdc |=> 4x 250Gb sata, existing raid 5 with data
/dev/sdd |


After the installation, I've activated ssh remote access (more practical).

here is how /dev/hda is partitionned :

/dev/md1 : /boot (hda2)
/dev/md2 : /     (hda1)
(later i can add another disk for mirroring the system disk, but currently i don't own another 120GB drive)

Now let's start the Raid 5 configuration :

Shutdown your machine :

shutdown -h now

Plugin your drives.

Restart the system.

Having a screen at boot time is practical to see if no error occurs at bootstrap. you can still see what happened with dmesg commande


Edit /etc/mdadm.conf
(the toughest job of this howto)

Modify mdadm.conf so that md0 is assembled automatically at bootstrap

Code: [Select]
#declare each partition used in raid systems
DEVICE /dev/hda1 /dev/hda2 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
MAILADDR root
#explicitly define each array
ARRAY /dev/md2 level=raid1 num-devices=2 devices=/dev/hda2 UUID=d7e61b0e:cf9a9687:86080da8:d2a37641
ARRAY /dev/md1 level=raid1 num-devices=2 devices=/dev/hda1 UUID=ac607e7c:a8eb1a88:239a9b3d:d53b617f
ARRAY /dev/md0 level=raid5 num-devices=4 devices=/dev/sda1,/dev/sdb1,/dev/sdc1,/dev/sdd1  UUID=6d750b1d:592a13a5:4bf373ba:02c6ed57


Here I totally change the way it was configured based on an article I found here :
http://www.linuxdevcenter.com/pub/a/linux/2002/12/05/RAID.html?page=1
As the author of this article says, the advantage of explicitly defining the raid in mdadm.conf is that it's easy to know which partition is used on which raid. whereas with entry like this :
ARRAY /dev/md1 super-minor=1
you don't know which partition is involved in /dev/md1 and have examine (ex:mdadm -E /dev/sda1) each drive to know how raid are configured if the raid is not assemble.
(of course if it's assemble, you can find out the configuration with mdadm --detail /dev/md1, and also on SME md1 and md2 are build with respectively the first partition and the second partition of each drive found at installation time, but additionnal array won't respect this naming convention)


Explanation :

DEVICE : list all partition involved in any RAID you want to use. so you liste partition for the system /dev/hda1 & 2 and the partition of your raid array as well.

MAILADDR : the mail address where alert should be sent on raid failure

ARRAY : defines the Raid ARRAY

The two first array are the SME default RAID 1 array.
use mdadm --detail /dev/md1 & mdadm --detail /dev/md2 to fill the two first ARRAY

first argument defines the superminor number

the second, the raid level, raid1 for mirroring, raid0 for stripping, raid5 distributed mirroring.

The third defines the number of device involved in the raid. For the raid1, 2 is set so that if you add a similar drive, SME server theorically mirror the system disk. (I've not tryed)

The fourth defines the partition involved in the array

The last one define the unviersal unique identifier of the array.

So for my RAID 5 with 4 disk, I've set raid5 level, 4 drives (1 spare + 3 working drives), and it's identifier.

To get the identifier of your existing RAID5 array try this command :

mdadm -E /dev/sda1

The 3rd line of the command output gives you the UUID of your RAID5 ARRAY.


Once you've configured mdadm.conf, save it.

and try this :

mdadm -A /dev/md0

it should automatically assemble your existing RAID5.

Then you can mount it to check that your data are still there :op

Code: [Select]
mkdir /mnt/data
mount /dev/md0 /mnt/data
ll /mnt/data



Then we need to configure the fstab file so that md0 is mounted automatically at boot time.

Add entry to fstab with vi (there maybe a cleaner way to edit this file, but I don't know how to yet...)
Code: [Select]
/dev/md0 /home/e-smith/files  ext3    usrquota,grpquota              1 1

You can actually do that, because the template that generate this file use the existing file /etc/fstab as a source (check /etc/e-smith/templates/fstab/template-begins)

So I choose to mount my raid5 array named /dev/md0 in /home/e-smith/files with ext3 filesystem, quota activated for user and group.
The two last parameters should be equals to 1 (the fisrt is to tell dump utility to try to save this filesystem, the second tells fsck that this partition has to be check regularly.)

As I choosed to automatically mount in /home/e-smith/files, I have to move existing files that lies in /home/e-smith/files, on the RAID5 array so that the SME server retrieve its primary ibay at the next boot:

Mount the Raid array in a temp directory (if not mounted) and do the move (ie : move the Primary ibay)

Code: [Select]
mkdir /mnt/data
mount /dev/md0 /mnt/data
mv /home/e-smith/files/* /mnt/data


Now you should move all you existing data into one directory and after raid5 setup, move your files into ibays you'll create.

So now you should restart your system. If there is error in fstab, you will be prompt at startup to boot in single user mode (ie only root can do something)
and you'll have to correct fstab, or comment the line you've added and then search why it's wrong.

Double check your configuration file before rebooting ;)

And it should work.

You should see SME files in /home/e-smith/files/ + your data.

It worked for me ;)

Additionnal information :

If your existing array had quota information, you should delete it and recreate quota informations as it may be inaccurate  (wrong user/group reference on the new SME system)
to delete it, I think deleting files aquota.group & aquota.user should be enough.

To create quota data :

quotacheck -cugm /dev/md0


If you want to create a new RAID5 (instead of assembling an existing one) here is what you should do :


Create the partition on your disks (delete any previous partition with d command, provided you saved the data on it ;)) :

Code: [Select]
fdisk /dev/sda
n  (creation of a partition)
p  (primary one)
1  (Partion 1)
[Return]  (partition start, use default : start of the disk)
[Return]  (partition end  , use default : end   of the disk)
w  (write the change, nothing is changed on the drive until you type the w command)

the same for sdb, sdc, sdd

raid5 creation
mdadm -Cv /dev/md0 -l5 -n4 -c128 /dev/sd{a,b,c,d}1

n : number of drive
l : level (5 for RAID5)
c : chunk size, 128 is good
/dev/sd{a,b,c,d}1 : drives involved in the array. it's a short version of /dev/sda1,/dev/sdb1,/dev/sdc1,/dev/sdd1


monitor the progress of the creation with :
cat /proc/mdstat
or
mdadm --detail /dev/md0

Format the filesystem :

mke2fs -j /dev/md0

Activate quota on /dev/md0

quotacheck -cugm /dev/md0


And now you can follow the guideline above.

Hope this helps you. feedback appreciated ;)


Paquerette.

Offline byte

  • *
  • 2,183
  • +2/-0
Re: Raid 5 Configuration... how to ? (1disk for system + 4 d
« Reply #1 on: June 30, 2006, 10:55:08 PM »
Quote from: "paquerette"

But... At startup there's some errors at startup saying that there's mixed raid configuration (raid 1 for /dev/hda and raid5 for /dev/sd[abcd])


That's because all your harddrives are not same size.

Quote

and the console tells that a manual intervention is required (but where.... ?)


Bug is already raised here, search to bug tracker to find out more.

Quote

Plus the template system... it's quite confusing


The Dev guide will help you here over in the development menu.

Quote

Where should I start to get my raid 5 configured ?


su into admin and go to 5. manage disk redundacy.
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Raid 5 Configuration... how to ? (1disk for system + 4 d
« Reply #2 on: July 01, 2006, 12:30:43 AM »
Quote from: "byte"

Quote

Where should I start to get my raid 5 configured ?


su into admin and go to 5. manage disk redundacy.


No, that won't help. The "manage disk redundacy" menu item is only for standard configurations, i.e. one or more disks of the same type and size. If you customise the system, e.g. by adding a RAID disk array, then you have to configure things on your own from the command line.

Please all read the User Guide.

tandum

Adding an existing RAID5 to a SME 7 HOWTO
« Reply #3 on: July 02, 2006, 03:55:44 PM »
SME always tries to set the boot disks as a raid pair and it will grab those disks from anywhere. cat /proc/mdstat to see what's happening. I find it best to install SME on the boot disks and then add addtional raid devices later.

paquerette

Adding an existing RAID5 to a SME 7 HOWTO
« Reply #4 on: July 02, 2006, 07:50:02 PM »
Quote from: "tandum"
SME always tries to set the boot disks as a raid pair and it will grab those disks from anywhere. cat /proc/mdstat to see what's happening. I find it best to install SME on the boot disks and then add addtional raid devices later.


I think I'll do that : re install (with the released version) without any 250Gb drives plugged and then plug my drives for the raid 5 later.

Thanks,
Paquerette.

Offline Daniel B.

  • *
  • 1,700
  • +0/-0
    • Firewall Services, la sécurité des réseaux
Adding an existing RAID5 to a SME 7 HOWTO
« Reply #5 on: July 07, 2006, 12:56:11 PM »
I have the same problem, I have a 4 hd raid 5 array (Raid software of an old SME server). I want this array to be mounted on a new server without loosing the data. I have install a new server  with SME 7.0 on a standard IDE hd. Then I pluged the 4 sata hd (the array) but I don't know how to mount them. with "fdisk -l" I see the 4 hd each one with two partitions (Linux raid autodetect). But when I try to mount one of them, the mount command stop telling me I must specify the filesystem type. What should I do?
C'est la fin du monde !!! :lol:

paquerette

Adding an existing RAID5 to a SME 7 HOWTO
« Reply #6 on: July 10, 2006, 08:46:36 PM »
So... I've reinstall SME server 7 final without my 4 hard drives plugged... i've plugged them after installation & configuration...

and  :


Quote
md2 : active raid1 hda2[0]
      120519552 blocks [2/1] [U_]

md1 : active raid1 sdd1[4] sdc1[3] sdb1[2] sda1[1]
      104320 blocks [5/4] [_UUUU]


But now... what should I do... can't find any configuration file to configure the RAID... How can I disable the Auto Raid feature ?


Paquerette

Offline raem

  • *
  • 3,972
  • +4/-0
Adding an existing RAID5 to a SME 7 HOWTO
« Reply #7 on: July 11, 2006, 10:15:28 AM »
paquerette

Search this forum for the Linux RAID Howto or google for it.
...

paquerette

Adding an existing RAID5 to a SME 7 HOWTO
« Reply #8 on: July 11, 2006, 05:14:39 PM »
ok,

I was thinking that someone already has done this on the SME (auto raid/template configuration files etc...) and discribe it...

I'm reading this :

http://www.linuxdevcenter.com/pub/a/linux/2002/12/05/RAID.html?page=1

Because SME rely on mdadm and not on raidtools (which was based on /etc/raidtab, and the fact that I didn't find this file on the sme has been disturbing for me).

I'll give feedback on how I'll succeed in configuring my raid 5

Paquerette

paquerette

Adding an existing RAID5 to a SME 7 HOWTO
« Reply #9 on: July 11, 2006, 05:51:01 PM »
well... that's not that simple...

SME auto raid is not welcome  on this case...


Quote
[root@www ~]# mdadm --detail --scan
ARRAY /dev/md2 level=raid1 num-devices=2 UUID=d7e61b0e:cf9a9687:86080da8:d2a37641
   devices=/dev/hda2
ARRAY /dev/md1 level=raid1 num-devices=5 UUID=5c00ad14:b4fef75a:9bff0a8e:8be81734
   devices=/dev/sda1,/dev/sdb1,/dev/sdc1,/dev/sdd1



Quote
[root@www ~]# cat /etc/mtab
/dev/mapper/main-root / ext3 rw,usrquota,grpquota 0 0
none /proc proc rw 0 0
none /sys sysfs rw 0 0
none /dev/pts devpts rw,gid=5,mode=620 0 0
usbfs /proc/bus/usb usbfs rw 0 0
/dev/md1 /boot ext3 rw 0 0
none /dev/shm tmpfs rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0


/boot is on /dev/md1 which is the 4*250Gb disk... which is absolutely silly and useless... also, the first line is strange... another indirection...

And i need to disable the autoraid....

Quote
[root@www ~]# cat /etc/mdadm.conf

# mdadm.conf written out by anaconda
DEVICE partitions
MAILADDR root
ARRAY /dev/md2 super-minor=2
ARRAY /dev/md1 super-minor=1


The conf file is generated by anaconda, so I'll have to dig into anaconda to find out how i can disable the auto raid feature...

Maybe in /root/anaconda-ks.cfg

Quote
[root@www ~]# cat anaconda-ks.cfg
# Kickstart file automatically generated by anaconda.

install
cdrom
lang en_US.UTF-8
langsupport --default=en_US.UTF-8 en_US.UTF-8
keyboard fr-latin1
rootpw --iscrypted $1$SyuSIFcf$OebEO5KirV9DkLcPllaRz0
firewall --enabled
selinux --disabled
authconfig --enableshadow --enablemd5
timezone --utc Europe/Paris
bootloader --location=mbr --driveorder=hda
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --all --initlabel
#part raid.100 --size=100 --ondisk=hda --asprimary
#part raid.110 --size=2268 --grow --ondisk=hda
#raid /boot --fstype ext3 --level=RAID1 raid.100
#raid pv.200 --fstype "physical volume (LVM)" --level=RAID1 raid.110
#volgroup main --pesize=32768 pv.200
#logvol swap --fstype swap --name=swap --vgname=main --size=768 --grow --maxsize=1536
#logvol / --fstype ext3 --name=root --vgname=main --size=1300 --grow

%packages
kernel
e2fsprogs
grub
mdadm
lvm2

%post


Strange place for a configuration file...


Paquerette

paquerette

Adding an existing RAID5 to a SME 7 HOWTO
« Reply #10 on: July 11, 2006, 06:38:30 PM »
great... the content of the four HD has been erased...

paquerette

Adding an existing RAID5 to a SME 7 HOWTO
« Reply #11 on: July 11, 2006, 08:26:33 PM »
Here is what I've done so far :

Quote
#restoration of /boot on /dev/hda
#backup copy
cp -R /boot /root/
umount /dev/md1
mount /dev/hda1

#stop of md1
mdadm -S /dev/md1

#Re-initi of disks
fdisk /dev/sda
d  (delete)
1  (partition 1)
d  (delete, partition 2 choose automatically)    
n  (creation of a partition)
p  (primary one)
1  (Partion 1)
[Return]  (partition start, use default : start of the disk)
[Return]  (partition end  , use default : end   of the disk)
w  (write)

the same for sdb, sdc, sdd

#raid5 creation
mdadm -Cv /dev/md1 -l5 -n4 -c128 /dev/sd{a,b,c,d}1

#monitor raid synchro :
cat /proc/mdstat
#or
mdadm --detail /dev/md1

#make the mount point
mkdir /data
#format the raid
mke2fs -j /dev/md1
#mount it...
mount /dev/md1 /data


Notice that for me the system is not a priority. A reinstallation & configuration of the system is done in less than an hour which is perfect for my home server.


Now I need to modify fstab and mtab and maybe more...

The templates files in /etc/e-smith/tempates/etc/fstab seems to use de berkley database, but can't find where the data are.

If you have any Ideas/suggestions...

paquerette

Adding an existing RAID5 to a SME 7 HOWTO
« Reply #12 on: July 15, 2006, 11:22:30 PM »
after a reboot, /boot is not duplicated on my 4 250GB drives anymore, but neither are my raid5 remounted at startup...

I guess it's because, i build the raid5 on /dev/md1 which seems to be reserved for /boot.

So i'll try to rebuild it on /dev/md0, and add

/dev/md0          /data                     ext3    usrquota,grpquota        1 1

to fstab via /etc/e-smith/templates-custom


What is the best solution :

  * mount my raid5 drive in /data and create symbolic link from ibays to /data/somewhere
  * Copy /home/e-smith/files/ibays to /dev/md0 (via a temporary mount) and then mount  /dev/md0 in /home/e-smith/files/ibays

?

paquerette

Adding an existing RAID5 to a SME 7 HOWTO
« Reply #13 on: July 16, 2006, 04:02:46 PM »
any opinion on what is the best mount point?

paquerette

Adding an existing RAID5 to a SME 7 HOWTO
« Reply #14 on: July 16, 2006, 04:27:34 PM »
Another big question :  Why the raid configuration is dissmissed after a reboot ?

After :

1/ creating the Raid /dev/md0
2/ partition it
3/ format it (ext3)
4/ add entry to fstab
5/ reboot

I get an error on boot saying that it can't find the superblock of /dev/md0

Question : How can I make persistent the raid configuration ?

Thanks.