RaidSoft-To manage the RAID SOFT

Dedicated Server Solution

To manage the RAID SOFT, we will use mdadm.

Attention: IT IS DANGEROUS TO PLAY WITH MDAM IF YOU DON’T KNOW WHAT YOU’RE DOING. YOU RISK LOSING THE DATA. BACKUP BEFORE READING OF THIS MANUAL

Note:
If your server just had its disk changed, then you have a disk in RAID soft and a blank disk that contains no partition table.

You must then copy the partition of the disk to the new one.

In case of SDA change:

sfdisk -d /dev/sdb | sfdisk /dev/sda

In case of SDB change:

sfdisk -d /dev/sda | sfdisk /dev/sdb

Note:
sfdisk does not support GPT partition tables, which will becoming more popular (for example it is default in XenServer? 6)

So if the server has GPT and Soft RAID, you use:
In case of SDA change:

sgdisk -R=/dev/sda /dev/sdb

In case of SDB change:

sgdisk -R=/dev/sdb /dev/sda

How to see list partitions on a disk?

cat /proc/partitions

or

parted /dev/sdX print

1.) MDADM installation

The rest of the MDADM softwares is not installed by default on the server.

In release 1:

rpm -Uvh –nodeps ftp://ftp.ovh.net/made-in-ovh/sources/mdadm-2.5.5p1-1.i386.rpm
Retrieving ftp://ftp.ovh.net/made-in-ovh/sources/mdadm-2.5.5p1-1.i386.rpm
Preparing… ########################################### 100%
1:mdadm ########################################### 100%

2.) Help

To further information use –help

# mdadm –misc –help
Usage: mdadm misc_option devices…

This usage is for performing some task on one or more devices, which
may be arrays or components, depending on the task.
The –misc option is not needed (though it is allowed) and is assumed
if the first argument in a misc option.

Options that are valid with the miscellaneous mode are:
--query -Q : Display general information about how a
device relates to the md driver
--detail -D : Display details of an array
--examine -E : Examine superblock on an array component
--examine-bitmap -X: Display contents of a bitmap file
--zero-superblock : erase the MD superblock from a device.
--run -R : start a partially built array
--stop -S : deactivate array, releasing all resources
--readonly -o : mark array as readonly
--readwrite -w : mark array as readwrite
--test -t : exit status 0 if ok, 1 if degrade, 2 if dead, 4 if missing

3.) Information

To get information about the status of the RAID use –misc command.

  1. mdadm –misc –detail /dev/md1

/dev/md1:
Version : 00.90.00
Creation Time : Tue Nov 7 22:01:16 2006
Raid Level : raid1
Array Size : 3068288 (2.93 GiB 3.14 GB)
Device Size : 3068288 (2.93 GiB 3.14 GB)
Raid Devices : 2
Total Devices : 1
Preferred Minor : 1
Persistence : Superblock is persistent

Update Time : Wed Nov 8 15:42:35 2006
State : active, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 0
Spare Devices : 0

UUID : 4a9a446d:af55e24b:b311aa61:8dc74ed4
Events : 0.12

Number Major Minor RaidDevice? State
0 8 1 0 active sync /dev/sda1
1 0 0 1 removed

We see that we have a RAID 1 of 3 Gb, which is in degraded mode because the sdb1 disk is missing.

4.) ADD is a disk in degraded mode.

Here is an example of commands, to add a disk to a raid in degraded mode:

  1. mdadm /dev/md1 –manage –add /dev/sdb1

mdadm: hot added /dev/sdb1

The raid in rebuilding.

  1. cat /proc/mdstat

Personalities : linear raid0 raid1 raid5
read_ahead 1024 sectors
md1 : active raid1 sdb12 sda10
3068288 blocks 2/1 U_
=>................... recovery = 5.4% (167028/3068288) finish=0.8min speed=55676K/sec
md2 : active raid1 sda20
240597376 blocks 2/1 U_

A few minutes later the reconstruction will be finished:

  1. mdadm –misc –detail /dev/md1

/dev/md1:
Version : 00.90.00
Creation Time : Tue Nov 7 22:01:16 2006
Raid Level : raid1
Array Size : 3068288 (2.93 GiB 3.14 GB)
Device Size : 3068288 (2.93 GiB 3.14 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 1
Persistence : Superblock is persistent

Update Time : Wed Nov 8 16:01:02 2006
State : active
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0

UUID : 4a9a446d:af55e24b:b311aa61:8dc74ed4
Events : 0.14

Number Major Minor RaidDevice? State
0 8 1 0 active sync /dev/sda1
1 8 17 1 active sync /dev/sdb1

We will do the same on md1:

  1. mdadm /dev/md2 –manage –add /dev/sdb2

mdadm: hot added /dev/sdb2

Rebuilding:

  1. mdadm –misc –detail /dev/md2

/dev/md2:
Version : 00.90.00
Creation Time : Tue Nov 7 22:01:16 2006
Raid Level : raid1
Array Size : 240597376 (229.45 GiB 246.37 GB)
Device Size : 240597376 (229.45 GiB 246.37 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 2
Persistence : Superblock is persistent

Update Time : Wed Nov 8 16:06:43 2006
State : active, degraded, recovering
Active Devices : 1
Working Devices : 2
Failed Devices : 0
Spare Devices : 1

Rebuild Status : 0% complete

UUID : e8754328:26f28599:8b834aba:ade37773
Events : 0.10

Number Major Minor RaidDevice? State
0 8 2 0 active sync /dev/sda2
1 0 0 1 removed

2 8 18 2 spare /dev/sdb2

  1. cat /proc/mdstat

Personalities : linear raid0 raid1 raid5
read_ahead 1024 sectors
md1 : active raid1 sdb11 sda10
3068288 blocks 2/2 UU

md2 : active raid1 sdb22 sda20
240597376 blocks 2/1 U_
>.................... recovery = 0.2% (655104/240597376) finish=73.2min speed=54592K/sec
unused devices: <none>

Check the size of your swap at the end.

cat /proc/swaps
Filename Type Size Used Priority
/dev/sdb3 partition 522104 43984 -1

You must now add the swap of the disk that you have just formatted and re-added to the RAID.

mkswap /dev/sda3
swapon -a

You can see with the free command that the whole swap space is activated again.

1 thought on “RaidSoft-To manage the RAID SOFT

  1. I think everything posted made a ton of sense.
    However, what about this? suppose you were to write
    a awesome post title? I ain’t saying your content isn’t solid.,
    but suppose you added a headline to possibly grab people’s attention?
    I mean RaidSoft-To manage the RAID SOFT | Web Hosting Solution | SEO | Domain
    | Web Design is a little boring. You might look at Yahoo’s home page and watch how they create post
    titles to grab people to click. You might try adding a video
    or a related pic or two to get readers interested about what you’ve written.

    Just my opinion, it could make your website a little
    bit more interesting.

Leave a Reply

Your email address will not be published. Required fields are marked *