| Red Hat This forum is for the discussion of Red Hat Linux. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
11-04-2004, 06:08 AM
|
#1
|
|
Member
Registered: Sep 2003
Location: Sydney Australia
Distribution: Redhat, Centos, Ubuntu
Posts: 282
Rep:
|
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

|
|
|
|
11-04-2004, 07:52 AM
|
#2
|
|
Guru
Registered: Jan 2001
Posts: 24,128
Rep: 
|
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.
|
|
|
|
11-04-2004, 09:10 AM
|
#3
|
|
Member
Registered: Sep 2003
Location: Sydney Australia
Distribution: Redhat, Centos, Ubuntu
Posts: 282
Original Poster
Rep:
|
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 !
|
|
|
|
11-04-2004, 03:47 PM
|
#4
|
|
Member
Registered: Sep 2003
Location: Sydney Australia
Distribution: Redhat, Centos, Ubuntu
Posts: 282
Original Poster
Rep:
|
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...
|
|
|
|
11-08-2004, 11:17 AM
|
#5
|
|
Member
Registered: Sep 2004
Location: Raleigh NC
Distribution: Fedora / RHEL
Posts: 171
Rep:
|
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
|
|
|
|
11-25-2004, 04:32 PM
|
#6
|
|
Member
Registered: Sep 2003
Location: Sydney Australia
Distribution: Redhat, Centos, Ubuntu
Posts: 282
Original Poster
Rep:
|
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......
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 07:31 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|