LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 11-04-2004, 06:08 AM   #1
FragInHell
Member
 
Registered: Sep 2003
Location: Sydney Australia
Distribution: Redhat, Centos, Solaris, Ubuntu, SUSE
Posts: 282

Rep: Reputation: 45
Software Raid - recreate failed disk.


Hi everyone,

I'm running a redhat 9.0 server for a friend, that has 2 80GB disks mirrored together (hda and hdc). All has been working fine. I've been looking at what would happens if a disk fails, and I can see that you must manually re-create the partition table when you replace a disk, does any one know a way of doing this automatically ? What I would like to do is create some sort of script so all my firend would have to do is replace the failed drive and the script would re-create the partitions and then re-start the mirror process.At the moment I'm stuck on the first bit, duplicating the partition information onto another disk.

Thanks
 
Old 11-04-2004, 07:52 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
sfdisk is your friend in this situation..

Say I have /dev/hda and I want the same partition layout for /dev/hdc I would do:

/sbin/sfdisk /dev/hda -f /dev/hdc

Then you can use raidhotadd to add the raid devices to sync them up.

Take a look at /proc/mdstat for any existing raid setup and you can use raidhotadd to add the any partition to an existing raid device.
 
Old 11-04-2004, 09:10 AM   #3
FragInHell
Member
 
Registered: Sep 2003
Location: Sydney Australia
Distribution: Redhat, Centos, Solaris, Ubuntu, SUSE
Posts: 282

Original Poster
Rep: Reputation: 45
Wow thanks, thats just what I needed !!

I've been looking at the new utils - mdadm which seams to make life a little easier to use, but it's only on later versions at the moment (FC 1 and 2). anyway thanks for that help !
 
Old 11-04-2004, 03:47 PM   #4
FragInHell
Member
 
Registered: Sep 2003
Location: Sydney Australia
Distribution: Redhat, Centos, Solaris, Ubuntu, SUSE
Posts: 282

Original Poster
Rep: Reputation: 45
Humm,

Sorry to report but just got home and tried it and it didn't work

I did

sfdisk /dev/hdc -f /dev/hda as i trashed /dev/hda and I wanted to copy it back from C back to A.

and way go the following error

sfdisk : can only specify only one device (expect wit -s or -l)

Help...
 
Old 11-08-2004, 11:17 AM   #5
hkb33
Member
 
Registered: Sep 2004
Location: Raleigh NC
Distribution: Fedora / RHEL
Posts: 171

Rep: Reputation: 30
Repartition the drive by hand using fdisk...try and get the partition sizes as close as you can to the survivng disk then raidhotadd the drive
 
Old 11-25-2004, 04:32 PM   #6
FragInHell
Member
 
Registered: Sep 2003
Location: Sydney Australia
Distribution: Redhat, Centos, Solaris, Ubuntu, SUSE
Posts: 282

Original Poster
Rep: Reputation: 45
Guys found the solution so thought I would share it with you.

This is my configuration.
Primary Master = hda
Secondary Master = hdc
CD-Rom = hdd.

You need to do this for both disks.

Firstly need to backup the disk's MBR, and basic partition table.
dd if=/dev/hda of=hda.mbr bs=512 count=1

Second - backup the disks partition table (including the extended information).
sfdisk -d /dev/hda > hda.sfd

Once a failed disk has been replaced, lets assume it was hda.

Restore the MBR.
dd if=hda.mbr of=/dev/hda bs=512 count=1
Restore the Extended Partition information as well.
sfdisk -O change.log /dev/hda <hda.sfd

Check that the partition table is loaded
fdisk -l /dev/hda

Restart the Mirror sync process.
raidhotadd /dev/md? /dev/hda

to see the progress of the mirroring - watch -n1 cat /proc/mdstat



Also to note that I'm using LILO - this seams to be installed on both disks, but grub only gets install on the primary disk. If you loose the primary disk - you cannot boot, but you can still boot if you loose the secondary disk. With lilo either disk can be lost and the system boots without problem.

Hope this helps anyone who was in the same boat i was......
 
  


Reply



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
Why can't I mount this md0 raid? (mdadm and software raid) cruiserparts Linux - Software 35 01-05-2013 03:35 PM
Can fake raid be converted to linux software raid? jmacdonald801 Linux - General 3 01-30-2005 12:33 PM
Software raid 5 always missing 1 disk after reboot birkinshawc Linux - Hardware 0 05-20-2004 10:57 PM
moving system from ide software raid to new box with scsi raid ftumsh Linux - General 0 10-28-2003 09:34 AM
Software Raid Setup Ok - Reboot fails on disk failure test ikke Linux - General 2 05-11-2003 06:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 10:13 AM.

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