Saturday, April 12, 2008

Howto: RAID1 on Mandriva

Setting up RAID1 on Mandriva 2008


1.Goal: Setup a system with two harddisks that contain identical data so that if
one harddisk crashes, the system survives.

2.The system should still be able to boot without manual intervention.

3.A mail should be send if one harddisk fails.

We chose only two harddisks also a CD-ROM or DVD-ROM must be connected to
be able to install the system.

Installation

Install the system as usual, but when partitioning choose 'Custom Disk
partitioning'.

1.Check if all harddisks (sda, sdb) are available

2.Click 'Toggle to Expert mode'

3.Click on the sda block

4.Click on 'Create'

5.Select 1000 (1GB) for /boot

6.Select Filesystem type 'Linux RAID'

7.Click 'Add to Raid' with md0

8.Click on the sda block

9.Click on 'Create'

10.Select 1000 (1GB) for LinuxSwap?

11.Select Filesystem type 'Linux RAID'

12.Click 'Add to Raid' with md1

13.Click on the sda block

14.Click on 'Create'

15.Select 10000 (10GB) for / (root)

16.Select Filesystem type 'Linux RAID'

17.Click 'Add to Raid' with md2

18.Click on the sda block

19.Click on 'Create'

20.Increase 'Size in MB' to it's maximum for /home

21.Click Ok

22.Select Filesystem type 'Linux RAID'

23.Click 'Add to Raid' with md3

24.Now Click on the sdb block

25.Click on 'Create'

26.Select 1000 (1GB) for /boot

27.Select Filesystem type 'Linux RAID'

28.Click 'Add to Raid' with md0

29.Click on the sdb block

30.Click on 'Create'

31.Select 1000 (1GB) for LinuxSwap?

32.Select Filesystem type 'Linux RAID'

33.Click 'Add to Raid' with md1

34.Click on the sdb block

35.Click on 'Create'

36.Select 10000 (10GB) for / (root)

37.Select Filesystem type 'Linux RAID'

38.Click 'Add to Raid' with md2

39.Click on the sdb block

40.Click on 'Create'

41.Increase 'Size in MB' to it's maximum for /home

42.Click Ok

43.Select Filesystem type 'Linux RAID'

44.Click 'Add to Raid' with md3

45.Now click on Raid block

46.Select first partition filesystem ext3

47.Select Mount Point /boot

48.Click on Raid block

49.Select second partition Filesystem type 'Linux Swap'

50.Select 3rd partition filesystem ext3

51.Select Mount Point / (root)

52.Select 4th partition filesystem ext3

53.Select Mount Point /home

54.Now we are finished. Click on 'Done' to finalize the partitioning.

55.Click on 'Ok' to apply it to all three disks.

56.During Installation you must install boot loader on both harddrive by
selecting md0

57.Continue with the rest of the installation and reboot the system when
finished.

Reboot the system, login as root and execute 'cat /proc/mdstat'. This will output on the percentage complete of the array, or whether it's complete and active.


[root@pk1 log]# cat /proc/mdstat
Personalities : [raid1]
md3 : active raid1 sda7[0]
300294912 blocks [2/1] [U_]

md1 : active raid1 sda5[0] sdb5[1]
1020032 blocks [2/2] [UU]

md0 : active raid1 sda1[0] sdb1[1]
1020032 blocks [2/2] [UU]

md2 : active raid1 sda6[0]
10233280 blocks [2/1] [U_]

unused devices:
[root@pk1 log]# mdadm /dev/md2 -a /dev/sdb6
mdadm: re-added /dev/sdb6
[root@pk1 log]# cat /proc/mdstat
Personalities : [raid1]
md3 : active raid1 sda7[0]
300294912 blocks [2/1] [U_]

md1 : active raid1 sda5[0] sdb5[1]
1020032 blocks [2/2] [UU]

md0 : active raid1 sda1[0] sdb1[1]
1020032 blocks [2/2] [UU]

md2 : active raid1 sdb6[2] sda6[0]
10233280 blocks [2/1] [U_]
[>....................] recovery = 1.4% (144000/10233280)
finish=2.3min speed=72000K/sec


Testing


Your raid volume must be configured with a persistent superblock and has
to be fully synchronized. Use the following command to verify whether
these conditions have been met:

mdadm -D /dev/md0

Make sure it says:

State : active

Persistence : Superblock is persistent

=================================

Monitoring

Monitoring the raid while the raid fail send email to the admin user

The following command can be added to /etc/rc.local:

nohup mdadm --monitor --mail=sysadmin@example.com --delay=300 /dev/md0 &

Labels: