Linux and RAID

Don´t be shy, Linux is fun! =)
User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

Linux and RAID

Post by ayu »

So for the first time I setup a RAID array with mirroring between two HDDs on my server at home.
The RAID itself is not related to Linux and is controlled by the BIOS, but I can still see both of the drives in Linux.

Is this normal?
I mean, since I can see both drives in the RAID mirror array (while booted into Debian and listing the drives with fdisk -l), how will I know which one to access, or maybe it doesn't matter?
Maybe I simply choose one and stick with it, and things will handle itself?

Anyone with any experience with this?
"The best place to hide a tree, is in a forest"

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Re: Linux and RAID

Post by bad_brain »

what says:

Code: Select all

cat /proc/mdstat
Image

User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

Re: Linux and RAID

Post by ayu »

bad_brain wrote:what says:

Code: Select all

cat /proc/mdstat
That resource doesn't exist (mdstat, that is)
"The best place to hide a tree, is in a forest"

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Re: Linux and RAID

Post by bad_brain »

odd. no RAID then. it should give you something like:
serv4:~# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sdb3[0] sda3[1]
930414528 blocks [2/2] [UU]

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

unused devices: <none>
was there any sync activity at all after assembling the RAID (would show in top by the i/o load)? checked syslog?
Image

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Re: Linux and RAID

Post by bad_brain »

are the kernel modules loaded?

Code: Select all

lsmod | grep md
Image

User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

Re: Linux and RAID

Post by ayu »

Just checked the syslog, can't find a single trace of raid :S
"The best place to hide a tree, is in a forest"

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Re: Linux and RAID

Post by bad_brain »

check lsmod, I am pretty sure the md kernel module isn't loaded then...
serv4:~# lsmod | grep md
md_mod 73920 3 raid1
Image

User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

Re: Linux and RAID

Post by ayu »

bad_brain wrote:check lsmod, I am pretty sure the md kernel module isn't loaded then...
serv4:~# lsmod | grep md
md_mod 73920 3 raid1

Yeah it wasn't loaded.
I set it to load at boot now, retbooted and it worked with cat /proc/mdstat, but the problem with the raid drives persist.
I read somewhere that it can be a problem with Squeeze not detecting the raid controller, so I'm thinking that maybe I should try installing Wheezy on that machine.

Thoughts?
"The best place to hide a tree, is in a forest"

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Re: Linux and RAID

Post by bad_brain »

hmmm....not much experience with RAID controller support, the only hardware one I use on my Gigabyte mainboard at home works fine with Squeeze. all other RAIDs I use are software ones, maybe that would be an option...at least for a test?

after disassembling the hardware RAID:

Code: Select all

apt-get install mdadm
Image

User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

Re: Linux and RAID

Post by ayu »

array deleted and tool installed.

The partitions are being encrypted as I am writing this.
I have created identical partitions that are currently being encrypted in an identical way.

Then when that is done, I will add them to the software raid array as RAID 1.
Would this be a correct way of doing it?
Or should I first add them to the software array, and THEN encrypt the resulting RAID drive?

The encryption takes a while, thus it's a pretty important question (not that I'm short on time ^^)
"The best place to hide a tree, is in a forest"

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Re: Linux and RAID

Post by bad_brain »

first create the array, and THEN encrypt it. if you first encrypt each drive it is pointless because once the RAID is established the drives are sync'd anyway.
so first create the array, wait until the drives are sync'd (you can see the progress via cat /proc/mdstat) and then encrypt it. you could of course sync and encrypt at the same time, but I guess it would take longer because the double i/o load at the same time would slow things down a lot.
Image

User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

Re: Linux and RAID

Post by ayu »

Roger that :)

Code: Select all

root@Teresa:/home/cats# cat /proc/mdstat 
Personalities : [raid1] 
md0 : active raid1 sdd1[1] sdc1[0]
      488384400 blocks super 1.2 [2/2] [UU]
      [>....................]  resync =  0.2% (999424/488384400) finish=113.7min speed=71387K/sec
      
unused devices: <none>
Thanks for the help buddy, I will report back when it's finished and encrypted :D
"The best place to hide a tree, is in a forest"

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Re: Linux and RAID

Post by bad_brain »

now it looks like it should! most important in that output is the [UU]....this means both disks are in the array, if one drops out (had that on a server with a faulty HDD a couple of times) it looks like [_U].

and you're welcome buddy....:D


P.S. a useful feature of mdadm is the mail notification in case a drive drops out the array, check the MAIL_TO parameter in the config (should be /etc/default/mdadm).
Image

User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

Re: Linux and RAID

Post by ayu »

bad_brain wrote:P.S. a useful feature of mdadm is the mail notification in case a drive drops out the array, check the MAIL_TO parameter in the config (should be /etc/default/mdadm).
I will absolutely do that!
"The best place to hide a tree, is in a forest"

User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

Re: Linux and RAID

Post by ayu »

Alright, postfix and apticron set up as well, and email configured in madm and apticron :)

My parameter was called "MAILADDR", but I guess it's the same?

Thanks for the help buddy!
And if you aren't already using apticron, I suggest you do :)
I use it on all of my servers and it works like a charm!
"The best place to hide a tree, is in a forest"

Post Reply