LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-10-2007, 12:12 PM   #1
combilli
Member
 
Registered: Oct 2006
Posts: 75

Rep: Reputation: 15
How to rebuild a software RAID


I've carelessly broke a software RAID 1 by deleting the partitions on 1 of the harddisk.

So the software raid is broken.

The system is still running.
And I want to rebuild the formatted harddisk and make the RAID1 running again ,which command should I use and how can I use it?
 
Old 02-10-2007, 03:36 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
It actually takes two commands.

I'll assume the good RAID-1 disk partition is /dev/hda1, the drive that was formatted is /dev/hdb, and the RAID-1 device is /dev/md0. As root:

1. Partition /dev/hdb the same as /dev/hda:

sfdisk -d /dev/hda | sfdisk /dev/hdb

2. Add the partition to the array:

mdadm /dev/md0 --add /dev/hdb1

You can verify that it is syncing up with:

cat /proc/mdstat
 
Old 02-20-2007, 08:16 AM   #3
combilli
Member
 
Registered: Oct 2006
Posts: 75

Original Poster
Rep: Reputation: 15
Hello..

Do I need to stop all server when I run the command mdadm?
that server was running dhcp....
 
Old 02-20-2007, 08:22 AM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
The synchronization is a background process; there will be no impact to the running system.
 
Old 02-20-2007, 08:41 AM   #5
combilli
Member
 
Registered: Oct 2006
Posts: 75

Original Poster
Rep: Reputation: 15
Thank

Thanks. I'm rebuilding the data partition now...

And it's working good.

If the system is for mail server, when server getting email, does it impact the sync?
 
Old 02-20-2007, 12:09 PM   #6
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
The sync will give priority to activity on the server. There is a minimum and maximum setting:

Code:
# cat /proc/sys/dev/raid/speed_limit_max 
200000
# cat /proc/sys/dev/raid/speed_limit_min 
1000
The minimum insures that the sync continues, even if the system is busy. You don't normally need to change the values, but you can via, for example:

echo "10000" > /proc/sys/dev/raid/speed_limit_max

Any changes take effect immediately.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
software raid rebuild sunhui Linux - Software 1 12-17-2006 09:15 PM
Debian Raid 5 rebuild catfishk Linux - Software 3 06-23-2006 09:21 PM
RAID 1 rebuild Roberto Colmegna Linux - Hardware 1 12-07-2005 07:58 PM
How to rebuild a damaged raid 1 array? mrpc_cambodia Linux - General 1 04-12-2005 08:22 AM
Rebuild Software RAID 1 thadco Linux - Newbie 1 06-03-2004 04:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration