-   Linux - Server (
-   -   rebuilding a raid5 array for file server. (

javaholic 04-17-2008 03:22 PM

[sorted]rebuilding a raid5 array for file server.
I have come to a point where i may need to reinstall debian 4.11 hosting a samba and file server with a 1.8TB raid 5 setup. I would normally be happy to just install on the operating system disk a 4.3GB drive. I would like to be able to make sure that i don't harm this raid5 with the reinstalling of debian and or if a better restore rebuild of debian is possible or which method/methods would be best suited to making sure i keep this raid5 and its data intact with minimum upset. I would get really upset if i lost this data.

debian installed on 4.3GB drive.

two 200Gb drives for /home and /var/www

and three 1TB drives for software raid5 using MD with drive named md0.

Any ideas on what to do or what you would do would be greatly appreciated. How can i avoid this situation in the future. This all came about because i restarted computer using the reset button on case.

i have already rewritten /etc/inittab which i had lost completely.

cdbunch 04-18-2008 06:40 PM

I don't know about reinstall options for debian. I have not done that. But it does not seem like this should not be a big problem. If you save a copy of your /etc/mdadm.conf file which should specify the set up info for the RAID array and restore it after you restore the OS the array should come up with the same configuration as long as the devices it is built from still have the same device names. mdadm --assemble option should be able to re-assemble the array if there were a problem.

If you do not have mdadm.conf you can generate the info needed for it with:

mdadm --detail --scan

You might also want to run:

mdadm --examine /dev/xxx

for each of the drives that are members of the array and keep that information handy. If you are really paranoid you could disconnect the array drives while you rebuild the OS to avoid any possibility of them getting damaged and reconnect them after you are satisfied that everything is ok.

The following link is a little old but still has good info on mdadm that you might find useful:

Cameron Bunch

javaholic 04-19-2008 08:02 AM

Does the follow contents look about right?


# mdadm.conf
# Please refer to mdadm.conf(5) for information about this file.

# by default, scan all partitions (/proc/partitions) for MD superblocks.
# alternatively, specify devices to scan, using wildcards if desired.
DEVICE partitions

# auto-create devices with Debian standard permissions
CREATE owner=root group=disk mode=0660 auto=yes

# automatically tag new arrays as belonging to the local system
HOMEHOST <system>

# instruct the monitoring daemon where to send mail alerts

# definitions of existing MD arrays
DEVICE /dev/sd??*
ARRAY /dev/md0 auto=yes level=raid5 num-devices=3 UUID=7e2fc55c:b3416bf4:7b403d38:22f8ac8c

# This file was auto-generated on Thu, 22 Nov 2007 10:32:43 +0000
# by mkconf $Id: mkconf 261 2006-11-09 13:32:35Z madduck $

you mentioned how to restore my array am i right in thinking i need to the following: with mdadm intact replacing one i get by installing md again after restart?

am i right?

cdbunch 04-19-2008 10:38 AM

Your mdadm.conf looks ok. Be sure that the specification of the disks that are members of the array (DEVICE /dev/sd??*) does refer to correct disks. It should already but it never hurts to check.

After you re-install the OS (I assume that is what you intend to do) you should be able to copy this mdadm.conf into your new /etc and the array should be automatically assembled at boot up. You will have to put the appropriate entry in fstab to get the array mounted at boot. You might want to copy the entry you currently have to update your new fstab being sure you have the same mount point in the new system.

I would try first just copying the mdadm.conf into place and rebooting. Then check the output of:

cat /proc/mdstat

to see if the array has been recognized. If so you should be able to mount /dev/md0 to the appropriate mount point (manually or via fstab) and things should be good.

If the automatic mount does not work you can test if mdadm can manually assemble the array. In any event doing all of this should not negatively impact the array or its data if the drives are intact. Avoid using mdadm to create a new array using these same disks. That could be necessary but can also cause some problems you do not want to have to deal with.

Cameron Bunch

cdbunch 04-19-2008 11:59 AM

One other thing that might be the case for Debian:

Is your mdadm.conf in /etc/ or /etc/mdadm/ ?

It will need to be in the right directory.

javaholic 04-21-2008 09:01 AM

thanks guys you have been a great help.

All times are GMT -5. The time now is 03:45 PM.