Things you don't do daily you tend to forget. I have a Linux server at home - well, I have several, but that's another story - this particular one use software RAID, a simple mirroring RAID-1. I've been using it quite long now and it has always worked well. You wont get the prestanda of a hardware RAID ofcourse, but you get about the same safety level.

Now and then you will still run into problems somehow, a failing disk, software errors, configuration errors... I have had a mysterious error on this one which I think I just solved though. Every time I rebooted the server one of the RAID-partitions would fail, one of the disks was missing. This made me a bit hesitant to reboot it, once it would come up at all and I was afraid I had managed to destroy the RAID. Luckily it wasn't so and I managed to repair it and get it up and running without  loosing anything. Anyway, today, when checking  /etc/mdadm/mdadm.conf I noticed a typo, might have crept in when I upgraded the Debian-distro when they changed device names in /dev.

Anyway, I'm rambling a bit now. The real point of this post, and others I hope/might make, is to collect a bunch of handy commands, configurations etc. I know I always forget how to do stuff. I spend hours researching things, set them up, get them to work. Only to forget all about it so when I have to redo it or change something I forgot all, the links I had is dead, or I dont find the same source again.

So here will follow a more or less sorted hopefully growing list of handy commands, configurations, tricks  etc. regarding software RAID on Debian Linux that is or has been useful to me, but that might also be useful for others.


Lost drive from RAID-1, re-add failed drive /dev/sda8 to raid /dev/md3:

 mdadm --manage /dev/md3 -a /dev/sda8

Check status of RAID:
~> cat /proc/mdstat
Personalities : [raid1]
md3 : active raid1 sda8[2] sdb8[1]
      140817600 blocks [2/1] [_U]
      [======>..............]  recovery = 34.5% (48633344/140817600) finish=47.2min speed=32499K/sec

md4 : active raid1 sda9[0] sdb9[1]
      240832 blocks [2/2] [UU]

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

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

md2 : active raid1 sda6[0] sdb6[1]
      9767424 blocks [2/2] [UU]

unused devices:

Showing status with one device rebuilding.