I'm having the problem that the spare disks on two of my arrays aren't automatically being added upon reboot. I can do so manually with mdadm --add (which causes the spare to be re-added, not just added).
I'd like this to be done automatically. Obviously I can do so in /etc/rc.local but I'd prefer to solve the underlying problem such that the machine will still boot in the event of a degraded array situation.
A bit of background:
I started out with four 320GB disks, each identically partitioned as follows:
Code:
root@via:~# sfdisk -l /dev/sda
Disk /dev/sda: 38913 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/sda1 0+ 121 122- 979933+ fd Linux raid autodetect
/dev/sda2 122 38912 38791 311588707+ fd Linux raid autodetect
/dev/sda3 0 - 0 0 0 Empty
/dev/sda4 0 - 0 0 0 Empty
The four large partitions were used to construct a RAID5 array without spares (although the info below does show the spare that I've since added):
Code:
root@via:~# mdadm --detail /dev/md2
/dev/md2:
Version : 00.90.03
Creation Time : Fri Jun 22 20:56:51 2007
Raid Level : raid5
Array Size : 934765824 (891.46 GiB 957.20 GB)
Used Dev Size : 311588608 (297.15 GiB 319.07 GB)
Raid Devices : 4
Total Devices : 5
Preferred Minor : 2
Persistence : Superblock is persistent
Update Time : Sat Jul 12 10:06:41 2008
State : clean
Active Devices : 4
Working Devices : 5
Failed Devices : 0
Spare Devices : 1
Layout : left-symmetric
Chunk Size : 64K
UUID : 714e46f1:479268a7:895e209c:936fa570
Events : 0.13758
Number Major Minor RaidDevice State
0 8 2 0 active sync /dev/sda2
1 8 18 1 active sync /dev/sdb2
2 8 34 2 active sync /dev/sdc2
3 8 50 3 active sync /dev/sdd2
4 8 82 - spare /dev/sdf2
The smaller partitions were turned into two RAID1 arrays, used as two swap partitions with equal priority:
Code:
root@via:~# mdadm --detail /dev/md[01]
/dev/md0:
Version : 00.90.03
Creation Time : Fri Jun 22 20:56:08 2007
Raid Level : raid1
Array Size : 979840 (957.04 MiB 1003.36 MB)
Used Dev Size : 979840 (957.04 MiB 1003.36 MB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Sat Jul 12 08:47:50 2008
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
UUID : 19e69537:f7a6aec8:5a5f7576:3fc29e0d
Events : 0.50
Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 8 33 1 active sync /dev/sdc1
/dev/md1:
Version : 00.90.03
Creation Time : Fri Jun 22 20:56:31 2007
Raid Level : raid1
Array Size : 979840 (957.04 MiB 1003.36 MB)
Used Dev Size : 979840 (957.04 MiB 1003.36 MB)
Raid Devices : 2
Total Devices : 3
Preferred Minor : 1
Persistence : Superblock is persistent
Update Time : Sat Jul 12 08:07:54 2008
State : clean
Active Devices : 2
Working Devices : 3
Failed Devices : 0
Spare Devices : 1
UUID : 5e728621:c8b356a8:01f8e270:f0e280cb
Events : 0.54
Number Major Minor RaidDevice State
0 8 17 0 active sync /dev/sdb1
1 8 49 1 active sync /dev/sdd1
2 8 81 - spare /dev/sdf1
So: how to I get the spares to automatically be re-enabled upon reboot?
I also want the /dev/sdf1 spare to migrate between /dev/md0 and /dev/md1 if the other array is degraded. To this end I've added spare-group definitions to /etc/mdadm/mdadm.conf, but I'm not sure that file is actually being used for anything.
Just for reference I include /etc/mdadm/mdadm.conf below.
Code:
root@via:~# cat /etc/mdadm/mdadm.conf
# mdadm.conf
#
# Please refer to mdadm.conf(5) for information about this file.
#
# by default, scan all partitions (/proc/partitions) for MD superblocks.
# alternatively, specify devices to scan, using wildcards if desired.
DEVICE partitions
# auto-create devices with Debian standard permissions
CREATE owner=root group=disk mode=0660 auto=yes
# automatically tag new arrays as belonging to the local system
HOMEHOST <system>
# instruct the monitoring daemon where to send mail alerts
MAILADDR root
# definitions of existing MD arrays
ARRAY /dev/md0 level=raid1 num-devices=2 UUID=19e69537:f7a6aec8:5a5f7576:3fc29e0d spare-group=swapgroup
ARRAY /dev/md1 level=raid1 num-devices=2 spares=1 UUID=5e728621:c8b356a8:01f8e270:f0e280cb spare-group=swapgroup
ARRAY /dev/md2 level=raid5 num-devices=4 spares=1 UUID=714e46f1:479268a7:895e209c:936fa570
# This file was auto-generated on Fri, 22 Jun 2007 19:12:10 +0000
# by mkconf $Id: mkconf 261 2006-11-09 13:32:35Z madduck $
MAILFROM root
Thanks!
Bookmarks