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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
11-04-2004, 07:08 AM
|
#1
|
Member
Registered: Sep 2003
Location: Sydney Australia
Distribution: Redhat, Centos, Solaris, Ubuntu, SUSE
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, 08:52 AM
|
#2
|
LQ Guru
Registered: Jan 2001
Posts: 24,149
|
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, 10:10 AM
|
#3
|
Member
Registered: Sep 2003
Location: Sydney Australia
Distribution: Redhat, Centos, Solaris, Ubuntu, SUSE
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, 04:47 PM
|
#4
|
Member
Registered: Sep 2003
Location: Sydney Australia
Distribution: Redhat, Centos, Solaris, Ubuntu, SUSE
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, 12:17 PM
|
#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, 05:32 PM
|
#6
|
Member
Registered: Sep 2003
Location: Sydney Australia
Distribution: Redhat, Centos, Solaris, Ubuntu, SUSE
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......
|
|
|
All times are GMT -5. The time now is 06:13 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
|
|