Hosting the world one click at a time
| Q: Convert a Linux system into Software RAID | |
|---|---|
Beware, this will probably destroy your system. Don't do it.
Also it makes a lot of assumptions about the structure of your system.
a) you have 4 partitions on your current hard drive:
/dev/sda1 /boot
/dev/sda2 /tmp
/dev/sda3 swap
/dev/sda4 /
b) you are running RHEL3 (or compatible)
c) your new drive is detected as /dev/hda.
d) your new drive is LARGER than your old drive
e) if you have an emergency, you have console access to your machine
f) you are able to think independently and improvise.
g) you understand exactly what is done in every step and why it's done.
===================================
Bring a single disk system into RAID
1) copy partition table: sfdisk -d /dev/sda | sfdisk /dev/hda
2) make it bootable, copy boot sector: dd if=/dev/sda of=/dev/hda bs=512 count=1
3) fdisk /dev/hda
a) change partition #4 to fill the entire disk by deleting and creating a new one
b) change all ext3 partitions to type "fd"
4) create md arrays:
a) mdadm --create /dev/md1 -l 1 -n 2 /dev/hda1 -f missing
b) mdadm --create /dev/md2 -l 1 -n 2 /dev/hda2 -f missing
c) mdadm --create /dev/md4 -l 1 -n 2 /dev/hda4 -f missing
5) partition all arrays: mkfs.ext3 /dev/mdX
6) create mount point: mkdir /newdrive;
7) mount up the array: mount /dev/md4 /newdrive
8) create other directories and set permissions:
mkdir /newdrive/boot;mkdir /newdrive/tmp;mkdir /newdrive/proc;mkdir /newdrive/dev; chmod 1777 /newdrive/tmp
9) mount other arrays
a) mount /dev/md1 /newdrive/boot
b) mount /dev/md2 /newdrive/tmp
10) copy data:
time rsync -av --exclude /dev --exclude /proc --exclude /mnt --exclude /var/named/run-root/proc/ --exclude /newdrive --delete / /newdrive/
11) edit boot configuration
vi /newdrive/boot/grub/grub.conf
change this line:
kernel /vmlinuz-2.4.21-53.EL ro root=LABEL=/
to:
kernel /vmlinuz-2.4.21-53.EL ro root=/dev/md4
12) edit file system mounts:
vi /newdrive/etc/fstab
change all lines that say "LABEL=/XX" to corresponding /dev/mdX
13) copy everything from /dev into /newdrive/dev otherwise system won't boot:
cp -Ravp /dev/* /newdrive/dev
14) new initrd:
cd /newdrive/boot; mkinitrd -v -f --preload=raid1 --fstab=/newdrive/etc/fstab initrd-`uname -r`.img `uname -r`
|
|
© 2000-2008 EBOUNDHOST. ALL RIGHTS RESERVED.