LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-14-2008, 09:27 AM   #1
ncsuapex
Member
 
Registered: Dec 2004
Location: Raleigh, NC
Distribution: CentOS 2.6.18-53.1.4.el5
Posts: 770

Rep: Reputation: 44
Replacing both disks on a RAID


I have a server that has 2 40GB drives which are in a RAID. I need to replace them both with 2 new 300 GB drives and keep the data. Ive read through some other posts but didn't really seem to get a clear understanding of what to do.

current setup:

df -hl
Filesystem Size Used Avail Use% Mounted on
/dev/md2 35G 30G 3.0G 91% /
/dev/md0 124M 13M 105M 11% /boot
none 497M 0 497M 0% /dev/shm


fdisk -l

Disk /dev/hda: 40.0 GB, 40020664320 bytes
16 heads, 63 sectors/track, 77545 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 260 131008+ fd Linux raid autodetect
/dev/hda2 261 4421 2097144 fd Linux raid autodetect
/dev/hda3 4422 77545 36854496 fd Linux raid autodetect

Disk /dev/hdb: 40.0 GB, 40020664320 bytes
16 heads, 63 sectors/track, 77545 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 * 1 260 131008+ fd Linux raid autodetect
/dev/hdb2 261 4421 2097144 fd Linux raid autodetect
/dev/hdb3 4422 77545 36854496 fd Linux raid autodetect



Can I take the 2nd drive out, put in the new 300GB drive, make the first drive write it's data to the new drive, then swap out the 1st drive and put in the 2nd 300GB drive and have the drive write it's data to the new drive? Or any other suggestions...



The current drives are IDE and on the first IDE channel, there is a CDROM only on the second IDE channel. Could I put both new drives on the second IDE channel, doing away with the CDROM and some how sync the drives up that way?


:edit:

This server is running FC2, yeah I know... It's on it's way to being upgraded...


cat raidtab
raiddev /dev/md2
raid-level 1
nr-raid-disks 2
chunk-size 256
persistent-superblock 1
nr-spare-disks 0
device /dev/hda3
raid-disk 0
device /dev/hdb3
raid-disk 1
raiddev /dev/md0
raid-level 1
nr-raid-disks 2
chunk-size 256
persistent-superblock 1
nr-spare-disks 0
device /dev/hda1
raid-disk 0
device /dev/hdb1
raid-disk 1
raiddev /dev/md1
raid-level 1
nr-raid-disks 2
chunk-size 256
persistent-superblock 1
nr-spare-disks 0
device /dev/hda2
raid-disk 0
device /dev/hdb2
raid-disk 1

:2nd edit:

cat mdstat
Personalities : [raid1]
md1 : active raid1 hda2[0] hdb2[1]
2096896 blocks [2/2] [UU]

md2 : active raid1 hda3[0] hdb3[1]
36854272 blocks [2/2] [UU]

md0 : active raid1 hda1[0] hdb1[1]
130816 blocks [2/2] [UU]

unused devices: <none>


mdadm -D /dev/md0
/dev/md0:
Version : 00.90.01
Creation Time : Thu Apr 25 15:31:48 2002
Raid Level : raid1
Array Size : 130816 (127.75 MiB 133.96 MB)
Device Size : 130816 (127.75 MiB 133.96 MB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 0
Persistence : Superblock is persistent

Update Time : Wed May 7 15:39:43 2008
State : clean, no-errors
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0


Number Major Minor RaidDevice State
0 3 1 0 active sync /dev/hda1
1 3 65 1 active sync /dev/hdb1
UUID : b9eec35e:6f3c30b5:4d8b14fa:47d5dbf6
Events : 0.3491
[root@hermes proc]# mdadm -D /dev/md2
/dev/md2:
Version : 00.90.01
Creation Time : Thu Apr 25 15:30:56 2002
Raid Level : raid1
Array Size : 36854272 (35.15 GiB 37.74 GB)
Device Size : 36854272 (35.15 GiB 37.74 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 2
Persistence : Superblock is persistent

Update Time : Wed May 14 10:57:45 2008
State : clean, no-errors
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0


Number Major Minor RaidDevice State
0 3 3 0 active sync /dev/hda3
1 3 67 1 active sync /dev/hdb3
UUID : 940f03af:d6a5be55:15d12ea9:1ce8eb5d
Events : 0.53463761

Last edited by ncsuapex; 05-14-2008 at 09:58 AM. Reason: raid
 
Old 05-14-2008, 03:13 PM   #2
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Arch/Manjaro, might try Slackware again
Posts: 1,851
Blog Entries: 14

Rep: Reputation: 284Reputation: 284Reputation: 284
Here's my thoughts, having recently done something similar:

Probably the safest (and easiest) thing would be to install both new disks in place of the old ones and restore from the backup you just made prior.

If you can't do that, then putting the new disks on the second IDE channel might work, but I suspect that you might eventually end up with boot order problems unless you are (very) careful.

If the machine is old enough to have 40G drives you might want to make sure that both IDE channels can see the 300G drives properly; the motherboard manual might have info on that, or you can just plug them in and see what a live CD makes of the situation.

You could probably do something pretty tricky with breaking the mirror, installing one new 300G disk, formatting it, adding it to the mirror and syncing, then repeat the process for the second disk, but I *think* you'd be stuck with your original partition sizes.
 
Old 05-14-2008, 08:30 PM   #3
ncsuapex
Member
 
Registered: Dec 2004
Location: Raleigh, NC
Distribution: CentOS 2.6.18-53.1.4.el5
Posts: 770

Original Poster
Rep: Reputation: 44
yeah from what I've been reading.. If I swapped one of the old drives with a larger drive it will only recognize the amount of the older drive. BUT if I did that... Could I repartition the new drive to expand it to it's full amount, then swap out the 2nd old drive with the 2nd new drive and then it should mirror as the entire amount?
 
Old 05-15-2008, 10:19 AM   #4
ncsuapex
Member
 
Registered: Dec 2004
Location: Raleigh, NC
Distribution: CentOS 2.6.18-53.1.4.el5
Posts: 770

Original Poster
Rep: Reputation: 44
The mother board is a e210882 so it should handled the 300GB hard drives. Still trying to figure out if I can swap the new drive out mirror it with one of the old drives, then expand the new drive to its full capicity, then mirror the 2nd drive. Also how would I go about making sure the boot partition gets transfered?


:EDIT:


Ok, think I found something.


resize2fs -f /dev/md0 400000M(changing this to my drive specs)

Could I swap out one of the drives with the new 300GB drive, mirror the new drive, THEN run the resize2fs command, then swap out the 2nd drives?




:EDIT:


Ok... change of plans. I am leaving the 2 old drives in place, ADDING the 2 new drives and just moving content over to the new drives. But I'd still like to know if the mirror/resize2fs would work..

Last edited by ncsuapex; 05-15-2008 at 11:01 AM. Reason: ..
 
Old 05-15-2008, 12:47 PM   #5
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Arch/Manjaro, might try Slackware again
Posts: 1,851
Blog Entries: 14

Rep: Reputation: 284Reputation: 284Reputation: 284
resize

I'm thinking that you can only resize the filesystem if you have a partition that's big enough. If you used LVM on RAID, you might be able to expand the partition size then resize the filesystem, but otherwise I think you'll be stuck with the original partitions. You don't want to change the partitions on a raid system, let alone try to resize them with gparted or something.
 
Old 05-16-2008, 07:17 AM   #6
ncsuapex
Member
 
Registered: Dec 2004
Location: Raleigh, NC
Distribution: CentOS 2.6.18-53.1.4.el5
Posts: 770

Original Poster
Rep: Reputation: 44
^ makes sense. Anyways. I added the 2 drives following this how to and every thing went well, except the 2 new drives do not show up in /etc/raidtab but they do show up in /proc/mdstat

how to:
http://www.sdmachelp.com/linuxraid.html


mdstat

md3 : active raid1 hdc1[0] hdd1[1]
293033536 blocks [2/2] [UU]

df -h shows

/dev/md3 276G 12G 250G 5% /"new_partition"



fdisk -l

Disk /dev/hdc: 300.0 GB, 300069052416 bytes
255 heads, 63 sectors/track, 36481 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdc1 1 36481 293033601 fd Linux raid autodetect

Disk /dev/hdd: 300.0 GB, 300069052416 bytes
255 heads, 63 sectors/track, 36481 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdd1 1 36481 293033601 fd Linux raid autodetect




How do I tell if it's actually mirrored?(raid1)
 
Old 05-16-2008, 10:57 AM   #7
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Arch/Manjaro, might try Slackware again
Posts: 1,851
Blog Entries: 14

Rep: Reputation: 284Reputation: 284Reputation: 284
Looks good to me, but what does mdadm --detail /dev/md3 show?

Not sure, but I think the /etc/raidtab file is left over from the "raidtools" days and is superfluous under mdadm. Never bothered with it myself, haven't had any problem (that I've noticed).

I guess the ultimate test of seeing whether the mirror worked is "failing" either disk as a test and seeing if the system still has the remaining array. You can mark a disk as failed using mdadm, OR remove each one separately from the array, OR powerdown the machine and physically unplug one of the drives to see what will happen. Of course after a simulated failure, you're going to have to do a recovery; ie. pretend the "failed" disk is a new one, re-add it to the array and resync/rebuild the array. Tedious.
 
Old 05-16-2008, 02:53 PM   #8
ncsuapex
Member
 
Registered: Dec 2004
Location: Raleigh, NC
Distribution: CentOS 2.6.18-53.1.4.el5
Posts: 770

Original Poster
Rep: Reputation: 44
^ thanks for the help.


After posting I did some more research and found out that the raidtab isn't used in fedora so that's a relief, just found it odd that the other raid was in there.. anyways..


mdadm --detail /dev/md3
/dev/md3:
Version : 00.90.01
Creation Time : Tue Jan 1 00:31:39 2002
Raid Level : raid1
Array Size : 293033536 (279.46 GiB 300.07 GB)
Device Size : 293033536 (279.46 GiB 300.07 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 3
Persistence : Superblock is persistent

Update Time : Fri May 16 15:50:48 2008
State : clean, no-errors
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0


Number Major Minor RaidDevice State
0 22 1 0 active sync /dev/hdc1
1 22 65 1 active sync /dev/hdd1
UUID : 224ddbbc:0eb0311a:49df2695:9a517e4c
Events : 0.20239


so looks good?
 
Old 05-16-2008, 09:39 PM   #9
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Arch/Manjaro, might try Slackware again
Posts: 1,851
Blog Entries: 14

Rep: Reputation: 284Reputation: 284Reputation: 284
Looks good to me, probably tedious overkill to "fail" a disk, still I guess it's a matter of philosophy....
 
  


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
Replacing the raid disks. coolbud Linux - Hardware 1 08-12-2006 10:44 AM
Replacing hard disks sickdude Linux - General 2 03-01-2006 03:59 PM
Replacing dead drive in degraded RAID-5. Cronjob Linux - Hardware 1 02-22-2006 11:02 PM
Raid Problem Fedora Core 3, RAID LOST DISKS ALWAYS icatalan Linux - Hardware 1 09-17-2005 03:14 AM
Replacing raid controler card yvesm Mandriva 1 06-10-2004 08:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:39 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