raid-one

Karl Larsen k5di at zianet.com
Wed Aug 15 20:34:23 UTC 2007


    I decided to write another paper that covers setting up a raid-1 
computer :-)   As always it is a lot of work. Here is the start of it. 
Please find errors and such and bring them to my attention. The paper is 
about 1/3 complete.


    A raid-1 configuration is defined as two Hard Drives (HD) having the 
same computer software on each of them. If one HD fails the other will 
continue to run and the computer will operate as if nothing had happened.

    Most of what is here is from an email of Jeffrey Ross who is a 
member of the Fedora Users List. I have just used some examples and 
re-ordering to suit my way of thinking.

    There are some special raid configuration software. One is "fdisk" 
and with that you can make partitions that have the special fd 
configuration. The other is called "mdadm" and it is written to be just 
a raid technical assett. Read man mdadm to see how capable it is.

    Here is what you MUST do.

1. Your current HD and F7 partition is /dev/sda5 and your new HD will be 
/dev/hdbx where x is a number from 1 to 7. The first thing to do is 
decide how to lay out the many partitions it can look like this:

/dev/sdb1 = /boot
/dev/sdb2 = /usr
/dev/sdb3 = swap
/dev/sdb4 = extended partition
/dev/sdb5 = /var
/dev/sdb6 = /
/dev/sdb7 = /home

    The partition size you find out by using "du -ch". For example to 
see how big /usr must be in a Terminal cd /usr and there type $ du -ch. 
On my F7 /usr is 3.4 Gbytes. So /dev/sdb2 should be 4 Gbytes or larger.

    Make the partitions with "fdisk". To do this you need to open a root 
Terminal and use # fdisk /dev/sdb. If your /dev/sdb is a new HD it will 
not show any partitions when you say p. On my old HD it shows this:

Command (m for help): p

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        1217     9775521   83  Linux
/dev/sdb2            1218        1945     5847660   83  Linux
/dev/sdb3            1946        1961      128520   82  Linux swap / Solaris
/dev/sdb4            1962       18534   133122622+   5  Extended
/dev/sdb5            1962        7060    40957686   83  Linux
/dev/sdb6            7061       12159    40957686   83  Linux
/dev/sdb7           12160       18534    51207156   83  Linux

Command (m for help):

As you can see the HD has 160 GB and it has 5 Linux file systems and a 
swap partition and /dev/sdb4 is an Extended partition.

    For our raid-1 work we want all partitions to be Linux raid 
autodetect which you get with "fdisk" when you make a new partition. 
Here is how it is done:

Command (m for help): n
First cylinder (12160-18534, default 12160):
Using default value 12160
Last cylinder or +size or +sizeM or +sizeK (12160-18534, default 18534): 
16000

Notice that I choose 16000 to end the partition. If you look the new 
partition has 30 GB total space.

/dev/sdb7           12160       16000    30852801   83  Linux

The type of partition is wrong. We don't want Linux. We want raid and 
that is done this way:

Command (m for help): t
Partition number (1-7): 7
Hex code (type L to list codes): l
Hex code (type L to list codes): fd
Changed system type of partition 7 to fd (Linux raid autodetect)

Command (m for help): p

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        1217     9775521   83  Linux
/dev/sdb2            1218        1945     5847660   83  Linux
/dev/sdb3            1946        1961      128520   82  Linux swap / Solaris
/dev/sdb4            1962       18534   133122622+   5  Extended
/dev/sdb5            1962        7060    40957686   83  Linux
/dev/sdb6            7061       12159    40957686   83  Linux
/dev/sdb7           12160       16000    30852801   fd  Linux raid 
autodetect

Command (m for help):

To save what we have shown here type w as in write the new things. I 
used q which means quit without saving.

    In our example we have to do the same thing for /dev/sdb1 through 7 
and it is easy to do and will not take long. Now our new HD is set to be 
a raid-1 HD.

2.
Now back to the old HD. We need to make the raid partition numbers which 
to make life simple will be the same as the new HD. We do this with 
"mdadm" as follows:

mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sdb1 missing
mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/sdb2 missing
mdadm --create /dev/md3 --level=1 --raid-devices=2 /dev/sdb3 missing
mdadm --create /dev/md5 --level=1 --raid-devices=2 /dev/sdb5 missing
mdadm --create /dev/md6 --level=1 --raid-devices=2 /dev/sdb6 missing
mdadm --create /dev/md7 --level=1 --raid-devices=2 /dev/sdb7 missing


-- 

	Karl F. Larsen, AKA K5DI
	Linux User
	#450462   http://counter.li.org.




More information about the fedora-list mailing list