Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"
Mercy Corps

 Create an AccountHome | Submit News | Your Account  

Tutorial Menu
Linux Tutorial Home
Table of Contents

· Introduction to Operating Systems
· Linux Basics
· Working with the System
· Shells and Utilities
· Editing Files
· Basic Administration
· The Operating System
· The X Windowing System
· The Computer Itself
· Networking
· System Monitoring
· Solving Problems
· Security
· Installing and Upgrading
· Linux and Windows

Glossary
MoreInfo
Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
FAQ
Copyright Info
Terms of Use
Privacy Info
Disclaimer
WorkBoard
Thanks
Donations
Advertising
Masthead / Impressum
Your Account

Communication
Feedback
Forums
Private Messages
Surveys

Features
HOWTOs
News Archive
Submit News
Topics
User Articles
Web Links

Google
Google


The Web
linux-tutorial.info

Who's Online
There are currently, 68 guest(s) and 0 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here

  

HOWTO Home

Current HOWTO: Boot + Root + Raid + Lilo : Software Raid mini-HOWTO


Boot + Root + Raid + Lilo : Software Raid mini-HOWTO: Upgrading from non-raid to RAID1/4/5 Next Previous Contents

4. Upgrading from non-raid to RAID1/4/5

Upgrading a non-raid system to raid is fairly easy and consists of several discrete steps described below. The description is for a system with a boot partition, root partition and swap partition.

OLD disk in the existing system:

    /dev/hda1     boot, may be dos+lodlin or lilo
    /dev/hda2     root
    /dev/hda3     swap
We will add an additional disk and convert the entire system to RAID1. You could easily add several disks and make a RAID5 set instead using the same procedure.

4.1 Step 1 - prepare a new kernel

Download a clean kernel, raidtools-0.90 (or the most recent version), and the kernel patch to upgrade the kernel to 0.90 raid.

Compile and install the raidtools and READ the documentation.

Compile and install the kernel to support all the flavors (0/1/4/5 ?) of raid that you will be using. Make sure to specify autostart of raid devices in the kernel configuration. Test that the kernel boots properly and examine /proc/mdstat to see that the raid flavors you will use are supported by the new kernel.

4.2 Step 2 - set up raidtab for your new raid.

The new disk will be added to an additional IDE controller as the master device, thus becomming /dev/hdc

    /dev/hdc1     16megs -- more than enough for several kernel images
    /dev/hdc2     most of the disk
    /dev/hdc3     some more swap space, if needed. otherwise add to hdc2

Change the partition types for /dev/hdc1 and /dev/hdc2 to "fd" for raid-autostart.

Using the failed-disk parameter, create a raidtab for the desired RAID1 configuration. The failed disk must be the last entry in the table.

# example raidtab
# md0 is the root array
raiddev                 /dev/md0
raid-level              1
nr-raid-disks           2
chunk-size              32
# Spare disks for hot reconstruction
nr-spare-disks          0
persistent-superblock   1
device                  /dev/hdc2
raid-disk               0
# this is our old disk, mark as failed for now
device                  /dev/hda2
failed-disk             1

# md1 is the /boot array
raiddev                 /dev/md1
raid-level              1
nr-raid-disks           2
chunk-size              32
# Spare disks for hot reconstruction
nr-spare-disks          0
persistent-superblock   1
device                  /dev/hdc1
raid-disk               0
# boot is marked failed as well
device                  /dev/hda1
failed-disk               1

4.3 Create, format, and configure RAID

Create the md devices with the commands:

    mkraid /dev/md0
    mkraid /dev/md1

The raid devices should be created and start. Examination of /proc/mdstat should show the raid personalities in the kernel and the raid devices running.

Format the boot and root devices with:

    mke2fs /dev/md0
    mke2fs /dev/md1
Mount the new root device somewhere handy and create the /boot directory and mount the boot partition.
    mount /dev/md0 /mnt
    mkdir /mnt/boot
    mount /dev/md1 /mnt/boot

4.4 Copy the current OS to the new raid device

This is pretty straightforward.

    cd /
    # set up a batch file to do this
    cp -a /bin /mnt
    cp -a /dev /mnt
    cp -a /etc /mnt
    cp -a (all directories except /mnt, /proc, and nsf mounts) /mnt
This operation can be tricky if you have mounted or linked other disks to your root file system. The example above assumes a very simple system, you may have to modify the procedure somewhat.

4.5 Test your new RAID

Make a boot floppy and rdev the kernel.

    dd if=kernal.image of=/dev/fd0 bs=2k
    rdev /dev/fd0 /dev/md0
    rdev -r /dev/fd0 0
    rdev -R /dev/fd0 1

Modify the fstab on the RAID device to reflect the new mount points as follows:

  /dev/md0        /       ext2    defaults        1 1
  /dev/md1        /boot   ext2    defaults        1 1

Dismount the raid devices and boot the new file system to see that all works correctly.

    umount /mnt/boot
    umount /mnt
    raidstop /dev/md0
    raidstop /dev/md1
    shutdown -r now

Your RAID system should now be up and running in degraded mode with a floppy boot disk. Carefully check that you transferred everything to the new raid system. If you mess up here without a backup, YOU ARE DEAD!

If something did not work, reboot your old system and go back and fix things up until you successfully complete this step.

4.6 Integrate old disk into raid array

Success in the previous step means that the raid array is now operational, but without redundancy. We must now re-partition the old drive(s) to fit into the new raid array. Remember that if the geometries are not the same, the the partition size on the old drive must be the same or larger than the raid partitions or they can not be added to the raid set.

Re-partition the old drive as required. Example:

    /dev/hda1     same or larger than /dev/hdc1
    /dev/hda2     same or larger than /dev/hdc2
    /dev/hda3     anything left over for swap or whatever...

Change the failed-disk parameter in the raidtab to raid-disk and hot add the new (old) disk partitions to the raid array.

    raidhotadd /dev/md1 /dev/hda1
    raidhotadd /dev/md0 /dev/hda2
Examining /proc/mdstat should show one or more of the raid devices reconstructing the data for the new partitions. After a minute or two... or so, the raid arrays should be fully synchronized (this could take a while for a large partition).

Using the procedure described in the first sections of this document, set up bootable raid on the new raid pair. Hang on to that boot floppy while setting up and testing this last step.


Next Previous Contents

The Linux Tutorial completely respects the rights of authors and artists to decide for themselves if and how their works can be used, independent of any existing licenses. This means if you are the author of any document presented on this site and do no wish it to be displayed as it is on this site or do not wish it to be displayed at all, please contact us and we will do our very best to accommodate you. If we are unable to accommodate you, we will, at your request, remove your document as quickly as possible.

If you are the author of any document presented on this site and would like a share of the advertising revenue, please contact us using the standard Feedback Form.


  
Show your Support for the Linux Tutorial

Purchase one of the products from our new online shop. For each product you purchase, the Linux Tutorial gets a portion of the proceeds to help keep us going.


Login
Nickname

Password

Security Code
Security Code
Type Security Code


Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Help if you can!


Amazon Wish List

Did You Know?
You can choose larger fonts by selecting a different themes.


Friends



Tell a Friend About Us

Bookmark and Share



Web site powered by PHP-Nuke

Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved.
The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look here

PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.56 Seconds