Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Replace old disk with 2 new, set up RAID1 and move all data
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
orb_ter
n00b
n00b


Joined: 27 Sep 2004
Posts: 13

PostPosted: Wed Nov 17, 2004 10:42 pm    Post subject: Replace old disk with 2 new, set up RAID1 and move all data Reply with quote

It's been a pain trying to "ghost" whole data disk to 2 new ones with RAID1 and actually boot from it. But here is how I did it if somebody may find it useful.

The old, poor and slow disk was set as /dev/hda. Let's put into machine two more new disks and arange them in this order:

hda (new disk - 40 Gb)
hdb (CD-ROM, as it was before)
hdc (new disk - 40 Gb)
hdd (old disk - 20 Gb, moved from hda to hdd)

Boot from LiveCD and do all necesary steps with network, but nothing is actually needed.

Code:
modprobe md


Edit /etc/raidtab to look like this (remember, hda and hdc are now new disks, hdd is the old one):
Code:

      raiddev         /dev/md0
      raid-level      1
      nr-raid-disks   2
      chunk-size      64
      persistent-superblock 1
      device          /dev/hda1
      raid-disk       0
      device          /dev/hdc1
      raid-disk       1


Next step is partitioning. I set it this way (for both hda and hdc the same):

/dev/hdX1 with 40 gigs and partition type Linux raid autodetect (fd)
/dev/hdX2 with 512 megs and partition type Linux Swap (82)

Since /dev/mdX wasn't yet created for raid I did it this way:

Code:
mknod /dev/md0 b 9 0


And after that loaded the raid1 module:

Code:
modprobe raid1


And also

Code:
mkraid /dev/md0


After that part we're ready to "ghost" data from old disk to RAID1 device with simple:

Code:
cat /dev/hdd > /dev/md0


It took about 15 minutes to complete. Then you have to check ned disks completely:

Code:
e2fsck -f /dev/md0


I wasn't satisfied that new root partition was as large as it was on old disk (20 gigs instead of 40) so I resized it with:

Code:
resize2fs -p /dev/md0


After that we're ready to mount and do some more things:

Code:
mount /dev/md0 /mnt/gentoo
mount -t proc none /mnt/gentoo/proc
chroot /mnt/gentoo /bin/bash
env-update; source /etc/profile


I assume you already had RAID1 support built in kernel on old disk. If not, go to /usr/src/linux, make menuconfig and go to Device Drivers --> Multi-device support (RAID and LVM) and select all of the following:

Code:
[*] Multiple devices driver support (RAID and LVM)                                     
<*> RAID support
< > Linear (append) mode
< > RAID-0 (striping) mode
<*> RAID-1 (mirroring) mode
< > RAID-4/RAID-5 mode
< > RAID-6 mode (EXPERIMENTAL)
< > Multipath I/O support
< > Device mapper support     


Do NOT compile them as modules! Then save config and do:

Code:
make bzImage modules modules_install


Copy new kernel to /boot:

Code:
cp System.map /boot
cp arch/i386/boot/bzImage /boot


After that, we have to make some corrections to grub (I wasn't able to make LILO work, after booting I kept getting Kernel Panic...)

So /boot/grub/grub.conf looks like this:

Code:
timeout 3
default 0
splashimage (hd0,0)/boot/grub/splash.xpm.gz
title Gentoo
root (hd0,0)
kernel /boot/bzImage root=/dev/md0


After this part I had some problems how to make grub write boot blocks correctly and I found answer on gentoo forums:

go to grub prompt and type:

Code:
root (hd0,0)
setup (hd0)
device (hd0) /dev/hdc
root (hd0,0)
setup (hd0)
quit


We're all set - hopefully, so:

Code:
exit
umount /mnt/gentoo/proc /mnt/gentoo
poweroff


After machine turned off, I removed old disk (hdd).
When powering it back on, Gentoo is back running on new disks with software RAID1.
Back to top
View user's profile Send private message
sparks
Guru
Guru


Joined: 05 Mar 2003
Posts: 329
Location: Nashville, TN

PostPosted: Sun Nov 21, 2004 5:31 am    Post subject: Reply with quote

Very useful information, thank you. I've been trying to make my mind up about whether or not I should buy a new 3ware Hardware RAID card or just use the software RAID built in the kernel. This will be done on my home server, dual Athlon MP 2400+ system. I bought a Tyan server MB with 64bit pci support so that I would be able run a nice 3ware 64 bit PCI RAID card. However, I've heard that the software RAID solutions can perform well also.

I do have one question about your setup. I noticed that you placed a hard drive and a CD-ROM drive on the same IDE channel. I may be wrong but doesn't placing a UDMA 33 optical device slow the IDE channel down to UDMA 33 speeds? I would like to have both my hard drives running at UDMA 133, which is what they are rated for. I think I remember a while back reading that RAID disks have to have a dedicated IDE channel; I.E you cannot have hda and hdb setup together in a RAID array. Can someone confirm or disprove this for me? Thank you.
_________________
True trade is honest, but not merciful. Politics is dishonest, no matter how merciful... and war is neither honest nor merciful.... therefore, choose trade above politics, but politics above war.
Back to top
View user's profile Send private message
NewBlackDak
Guru
Guru


Joined: 02 Nov 2003
Posts: 512
Location: Utah County, UT

PostPosted: Sun Nov 21, 2004 8:39 am    Post subject: Reply with quote

sparks wrote:
Very useful information, thank you. I've been trying to make my mind up about whether or not I should buy a new 3ware Hardware RAID card or just use the software RAID built in the kernel. This will be done on my home server, dual Athlon MP 2400+ system. I bought a Tyan server MB with 64bit pci support so that I would be able run a nice 3ware 64 bit PCI RAID card. However, I've heard that the software RAID solutions can perform well also.

I do have one question about your setup. I noticed that you placed a hard drive and a CD-ROM drive on the same IDE channel. I may be wrong but doesn't placing a UDMA 33 optical device slow the IDE channel down to UDMA 33 speeds? I would like to have both my hard drives running at UDMA 133, which is what they are rated for. I think I remember a while back reading that RAID disks have to have a dedicated IDE channel; I.E you cannot have hda and hdb setup together in a RAID array. Can someone confirm or disprove this for me? Thank you.


It is no longer true that all your both ide devices on the same channel operate at the slower speed. It hasn't been that way for a LONG time. You "can" have two raid disks on the same channel, but it's silly. It will slow them down. The controller cannot access both disks at once, so each will have to wait for the other. This is also why it's better if each harddrive is on a dedicated channel without any other device.
_________________
Gentoo systems.
X2 4200+@2.6 - Athy
X2 3600+ - Myth
UltraSparc5 440 - sparcy
Back to top
View user's profile Send private message
sparks
Guru
Guru


Joined: 05 Mar 2003
Posts: 329
Location: Nashville, TN

PostPosted: Sun Nov 21, 2004 8:53 am    Post subject: Reply with quote

NewBlackDak wrote:
It hasn't been that way for a LONG time.


Hehe, I guess I'm showing my age there. 8) Thanks for the useful information about newfangled IDE devices. What is your take on hardware RAID vs. software RAID?
_________________
True trade is honest, but not merciful. Politics is dishonest, no matter how merciful... and war is neither honest nor merciful.... therefore, choose trade above politics, but politics above war.
Back to top
View user's profile Send private message
orb_ter
n00b
n00b


Joined: 27 Sep 2004
Posts: 13

PostPosted: Sun Nov 21, 2004 7:53 pm    Post subject: Reply with quote

sparks wrote:
I do have one question about your setup. I noticed that you placed a hard drive and a CD-ROM drive on the same IDE channel. I may be wrong but doesn't placing a UDMA 33 optical device slow the IDE channel down to UDMA 33 speeds? I would like to have both my hard drives running at UDMA 133, which is what they are rated for. I think I remember a while back reading that RAID disks have to have a dedicated IDE channel; I.E you cannot have hda and hdb setup together in a RAID array. Can someone confirm or disprove this for me? Thank you.


It doesn't slows down the hard disk performance. With RAID it's better that way then having BOTH hard disks on the same channel. There are 2 reasons why:

1. Disks have to wait for each other
2. (most important): If one disk fail, both will be inaccessible because channel will be blocked

Anyway I don't need CD-ROM connected all the time, only for booting from it. I try to keep server machine as clean as possible so I took also floppy out :-)
Back to top
View user's profile Send private message
orb_ter
n00b
n00b


Joined: 27 Sep 2004
Posts: 13

PostPosted: Sun Nov 21, 2004 7:59 pm    Post subject: Reply with quote

sparks wrote:
NewBlackDak wrote:
It hasn't been that way for a LONG time.


Hehe, I guess I'm showing my age there. 8) Thanks for the useful information about newfangled IDE devices. What is your take on hardware RAID vs. software RAID?


About SW vs. HW RAID.... I think the only advantage is performance. At work we use both, SW on older servers and HW on newer ones (they came with HW RAID). But I don't see any difference so I guess SW RAID under linux is very well made.

Another point of having HW RAID in my opinion is hotswapping. Machines with those controllers has hot swappable driver that can be replaced and synced while the machine is operating so it's always available. I don't know if SW RAID support hotswapping even if hardware controllers and disk does...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum