rbartz
asked on
Setting up RAID1 to new HDD on running Linux Web Server
I need to set up RAID1 mirror on a currently running web server with 100 domains, 500 mail accounts. Here is what we have:
Linux 7.3 with standard kernal 2.4
RAIDTOOLS installed
pretty much standard install, few things added from standard, nothing big
1 80Gb IDE HDD (hda) partitioned as follows:
1 Linux 1 6 /boot
2 Linux swap 7 134 swap
3 Extended 135 10011
5 Linux 135 389 /
6 Linux 390 772 /usr
7 Linux 773 1410 /var
8 Linux 1411 10011 /home
1 new 80Gb IDE HDD (hdc) identical to hda, not yet partitioned
I am accessing the server (leased, dedicated) remotely with SSH, as root.
No tape backup
cat /proc/mdstat
Personalities : [raid0] [raid1] [raid5]
read_ahead not set
unused devices: <none>
========================== ==
Here is what we want to do:
We need to keep everything mirrored so that if one or the other hard disks fails, we will neither lose data nor have to take more than a short time to recover with a new hard disk.
What I want is a step by step guide for partitioning the new hard disk and setting up the necessary filesystems (ext2, ext 3, LINUX raid????) or devices, then creating the raidtab file and any other files that need to be created or edited or updated (fstab?), then starting the thing and making sure it is running.
I hope this is enough to get us going... THANKS!
Richard
Linux 7.3 with standard kernal 2.4
RAIDTOOLS installed
pretty much standard install, few things added from standard, nothing big
1 80Gb IDE HDD (hda) partitioned as follows:
1 Linux 1 6 /boot
2 Linux swap 7 134 swap
3 Extended 135 10011
5 Linux 135 389 /
6 Linux 390 772 /usr
7 Linux 773 1410 /var
8 Linux 1411 10011 /home
1 new 80Gb IDE HDD (hdc) identical to hda, not yet partitioned
I am accessing the server (leased, dedicated) remotely with SSH, as root.
No tape backup
cat /proc/mdstat
Personalities : [raid0] [raid1] [raid5]
read_ahead not set
unused devices: <none>
==========================
Here is what we want to do:
We need to keep everything mirrored so that if one or the other hard disks fails, we will neither lose data nor have to take more than a short time to recover with a new hard disk.
What I want is a step by step guide for partitioning the new hard disk and setting up the necessary filesystems (ext2, ext 3, LINUX raid????) or devices, then creating the raidtab file and any other files that need to be created or edited or updated (fstab?), then starting the thing and making sure it is running.
I hope this is enough to get us going... THANKS!
Richard
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I've not had the problems that marko has experienced. And those instructions were essentially notes I made while doing a conversion to RAID 1 very, very, remotely. I did have someone on-site that could reboot the system via the boot floppy, and I made sure that would work before starting the conversion. Since then I've done this a number of times without anything odd occuring.
ASKER
Thank you jlevie, and you too marko, I am warned... :-)
Our server is leased, and I cannot get physical access to it. Remote is my only choice. I will need to arrange a time to do this so that a support tech can help with creating the floppy and rebooting (there may already be a bootable floppy on the machine).
I think RAID1 will be much better than using the second drive to do full and incremental backups. That is easy enough to do, but will not help us get back on line quickly if a hard drive fails. We need the best way that we can afford, and RAID1 is it for now. The risk is worth the difference.
jlevie, I have questions about the following steps! Appreciate your help.
Additional info: our original hard disk is hda. The new one is hdc. They are identical drives in every way. Also, I have Webmin installed, updated, and all the modules are working for creating partitions and so on, including the RAID module.
2... how do I mark the current boot drive as failed when I create the /etc/raidtab?
4... how do I create the filesystem and labels on the new partitions?
5... How do I make an initrd image, and how do I know if my GRUB (vers. 0.90) is configured to use it? I do not have a grub.conf file....! Will we need to install GRUB? I suppose we are using lilo, the lilo.conf file is:
prompt
timeout=10
default=linux
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
lba32
image=/boot/vmlinuz-2.4.17 -ci
label=linux-old-ci
read-only
root=/dev/hda5
image=/boot/vmlinuz-2.4.7- 10smp
label=emerg-smp
initrd=/boot/initrd-2.4.7- 10smp.img
read-only
root=/dev/hda5
image=/boot/vmlinuz-2.4.7- 10
label=emerg-up
initrd=/boot/initrd-2.4.7- 10.img
read-only
root=/dev/hda5
image=/boot/memtest
label=memtest
image=/boot/vmlinuz-2.4.23 -ci
label=linux-old
read-only
root=/dev/hda5
image=/boot/vmlinuz-2.4.25 -ci
label=linux
read-only
root=/dev/hda5
image=/boot/vmlinuz-2.4.20 -smp-rf1
label=linux-scsi
read-only
root=/dev/hda5
8... the current root=/dev/hda5, so I assume that the new line would be something like root=/dev/md3...?
9. Reboot should work without the floppy if I am reading between the lines here correctly. Is there anything I should be aware of if it doesn't and we have to reboot from the floppy? If the reboot failed from the hard drives, what would be the most likely reasons?
10... the correct command for fdisk to change the partition type?
I think I understand the rest, I am travelling again tomorrow so will see about doing all this Wednesday night after making and downloadfing backups. Thanks for your help.
Richard
Our server is leased, and I cannot get physical access to it. Remote is my only choice. I will need to arrange a time to do this so that a support tech can help with creating the floppy and rebooting (there may already be a bootable floppy on the machine).
I think RAID1 will be much better than using the second drive to do full and incremental backups. That is easy enough to do, but will not help us get back on line quickly if a hard drive fails. We need the best way that we can afford, and RAID1 is it for now. The risk is worth the difference.
jlevie, I have questions about the following steps! Appreciate your help.
Additional info: our original hard disk is hda. The new one is hdc. They are identical drives in every way. Also, I have Webmin installed, updated, and all the modules are working for creating partitions and so on, including the RAID module.
2... how do I mark the current boot drive as failed when I create the /etc/raidtab?
4... how do I create the filesystem and labels on the new partitions?
5... How do I make an initrd image, and how do I know if my GRUB (vers. 0.90) is configured to use it? I do not have a grub.conf file....! Will we need to install GRUB? I suppose we are using lilo, the lilo.conf file is:
prompt
timeout=10
default=linux
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
lba32
image=/boot/vmlinuz-2.4.17
label=linux-old-ci
read-only
root=/dev/hda5
image=/boot/vmlinuz-2.4.7-
label=emerg-smp
initrd=/boot/initrd-2.4.7-
read-only
root=/dev/hda5
image=/boot/vmlinuz-2.4.7-
label=emerg-up
initrd=/boot/initrd-2.4.7-
read-only
root=/dev/hda5
image=/boot/memtest
label=memtest
image=/boot/vmlinuz-2.4.23
label=linux-old
read-only
root=/dev/hda5
image=/boot/vmlinuz-2.4.25
label=linux
read-only
root=/dev/hda5
image=/boot/vmlinuz-2.4.20
label=linux-scsi
read-only
root=/dev/hda5
8... the current root=/dev/hda5, so I assume that the new line would be something like root=/dev/md3...?
9. Reboot should work without the floppy if I am reading between the lines here correctly. Is there anything I should be aware of if it doesn't and we have to reboot from the floppy? If the reboot failed from the hard drives, what would be the most likely reasons?
10... the correct command for fdisk to change the partition type?
I think I understand the rest, I am travelling again tomorrow so will see about doing all this Wednesday night after making and downloadfing backups. Thanks for your help.
Richard
For this task it would be best to forget that you ever had webmin installed. All of it will beed to be done from the command line using the utilities I mention in the notes. And you'd be well advised to not use webmin for maintenance of this server. I've made an obscene amount of money as a consultant in fixing systems that were mucked up beyond comprehension by webmin. Hmm, on second thought continue to use webmin and keep in mind that I do consulting, fo a fee...
Seriously, learning the in's and out's of managing a server via command line tools and direct editing of files is a skill worth having. It really isn't that hard to do, there's never any doubt as to what changes have been made, and it doesn't require that one have a functioning web server.
2... Using /boot as an example the initial raidtab entry would look like:
# /boot
raiddev /dev/md0
raid-level 1
nr-raid-disks 2
chunk-size 64k
persistent-superblock 1
nr-spare-disks 0
device /dev/hda1
raid-disk 0
failed-disk 0
device /dev/hdc1
raid-disk 1
4... You execute 'fdisk /dev/hdc' and create the partition (see 'man fdisk'). It's not as difficult as it might seem. The fdisk program is menu driven. In step 4 above you'd use 'mke2fs -j -L /boot /dev/md0', for example
5... You really should switch to Grub. Depending on what version of Lilo you have it may not be capable of booting from a RAID 1 system.
8... That all depends on how you define the RAID devices in the raidtab. The root (/) could be md0, md1 or anything else. All that matters is that the grub.conf and fstab point to the correct RAID device.
9... Yes, it should boot from the RAID device, but just in case you want to be sure that you have a bootable floppy and that it will work.
10... Within fdisk the 't' menu item is used to set the partition type.
Seriously, learning the in's and out's of managing a server via command line tools and direct editing of files is a skill worth having. It really isn't that hard to do, there's never any doubt as to what changes have been made, and it doesn't require that one have a functioning web server.
2... Using /boot as an example the initial raidtab entry would look like:
# /boot
raiddev /dev/md0
raid-level 1
nr-raid-disks 2
chunk-size 64k
persistent-superblock 1
nr-spare-disks 0
device /dev/hda1
raid-disk 0
failed-disk 0
device /dev/hdc1
raid-disk 1
4... You execute 'fdisk /dev/hdc' and create the partition (see 'man fdisk'). It's not as difficult as it might seem. The fdisk program is menu driven. In step 4 above you'd use 'mke2fs -j -L /boot /dev/md0', for example
5... You really should switch to Grub. Depending on what version of Lilo you have it may not be capable of booting from a RAID 1 system.
8... That all depends on how you define the RAID devices in the raidtab. The root (/) could be md0, md1 or anything else. All that matters is that the grub.conf and fstab point to the correct RAID device.
9... Yes, it should boot from the RAID device, but just in case you want to be sure that you have a bootable floppy and that it will work.
10... Within fdisk the 't' menu item is used to set the partition type.
ASKER
I apologize for the delay in accepting your answer, jlevie, I was travelling for last 5 months!
Works perfectly.
RDB
Works perfectly.
RDB
The biggest problem I think was that partitions on the original disk needed to be shortened because RAID needed to write some additional information at the end of partitions. I used software RAID and I have found instructions on the internet. I think it was one of HOWTOs for Linux.
I am not giving you a solution because I see jlevie has done that. I just want to warn you that you may get in trouble. And the last advice. Don't do it remotely.