Date created: 09/06/11 19:32:13. Last modified: 11/10/17 11:56:30

'mdadm' - Notes

Example mdadm.conf for building from config file;

# 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 

# instruct the monitoring daemon where to send mail alerts
MAILADDR root

# definitions of existing MD arrays
# commented out for lower entry
# ARRAY /dev/md0 level=raid6 num-devices=7
UUID=dbfdc05b:a8f54568:e368bf24:bd0fce41

# This file was auto-generated on Sat, 10 Jul 2010 22:02:49 +0100
# by mkconf $Id$

# Editied by Bensley to add the array in at start up
ARRAY /dev/md0 level=raid6 num-devices=5 metadata=00.90
UUID=dbfdc05b:a8f54568:e368bf24:bd0fce41

Add mdadm.conf array to fstab:

# Added by bensley for array at start up /dev/md0
/dev/md0        /media/Array    ext3    defaults        0       0

Here we can see a failed drive;

[email protected]:~# cat /proc/mdstat 

Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 

md0 : active raid6 sde1[7](F) sdc1[4] sdd1[1] sda1[0] sdf1[5] sdg1[2]
          4883799680 blocks level 6, 64k chunk, algorithm 2     [7/5]     [UUU_UU_]      

unused devices: <none>

 

It can't be removed because its not there;

[email protected]:~# dmesg
[ 160.111575] md: md0: recovery done.
[ 160.301399] RAID5 conf printout:
[ 160.301404] --- rd:7 wd:5
[ 160.301409] disk 0, o:1, dev:sda1
[ 160.301414] disk 1, o:1, dev:sdd1
[ 160.301418] disk 2, o:1, dev:sdg1
[ 160.301422] disk 3, o:0, dev:sde1
[ 160.301425] disk 4, o:1, dev:sdc1
[ 160.301429] disk 5, o:1, dev:sdf1
[ 160.330015] RAID5 conf printout:
[ 160.330020] --- rd:7 wd:5
[ 160.330025] disk 0, o:1, dev:sda1
[ 160.330029] disk 1, o:1, dev:sdd1
[ 160.330033] disk 2, o:1, dev:sdg1
[ 160.330037] disk 4, o:1, dev:sdc1
[ 160.330041] disk 5, o:1, dev:sdf1
[ 162.060039] ata9: SATA link down (SStatus 0 SControl 300)
[ 162.060047] ata9.00: link offline, clearing class 1 to NONE
[ 162.060055] ata9: EH complete

[email protected]:~# mdadm --manage /dev/md0 --remove /dev/sde1
mdadm: metadata format 00.90 unknown, ignored.
mdadm: cannot find /dev/sde: No such file or direct

[email protected]:~# mdadm /dev/md0 -r detached
mdadm: metadata format 00.90 unknown, ignored.
mdadm: hot removed 8:65


[email protected]:~# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid6 sdc1[4] sdd1[1] sda1[0] sdf1[5] sdg1[2]
4883799680 blocks level 6, 64k chunk, algorithm 2 [7/5] [UUU_UU_]

unused devices:

To mount at start up:


# See the RAID is online
[email protected]:~$ cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid5 sdd1[4] sdc1[1] sde1[2] sdb1[0]
      8790401640 blocks super 1.2 level 5, 4k chunk, algorithm 2 [4/4] [UUUU]
      bitmap: 0/22 pages [0KB], 65536KB chunk

unused devices: <none>

# Use mdadm to list the array details
[email protected]:~$ sudo mdadm --examine --scan
[sudo] password for bensley:
ARRAY /dev/md/0 metadata=1.2 UUID=8ea128cd:47130c7a:9fb4a5a5:66750b6b name=htpc-ubuntu:0

# Make sure we have a mount point created
[email protected]:~$ ls -l /media/bensley/
total 8
drwxr-xr-x 2 root root 4096 May 20 17:40 9TB-Array
drwxr-xr-x 2 root root 4096 Jul 19 20:04 temp



[email protected]:~$ sudo vi /etc/fstab
# Add this line to fstab
/dev/md/0 /media/bensley/9TB-Array ext4 rw,nosuid,nodev,uhelper=udisks2 0 2

# Check
[email protected]:~$ sudo mount -a

[email protected]:~$ mount
/dev/sda6 on / type ext4 (rw,errors=remount-ro)
/dev/md0 on /media/bensley/9TB-Array type ext4 (rw,nosuid,nodev,uhelper=udisks2)

[email protected]:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda6        54G  6.8G   44G  14% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            1.8G  4.0K  1.8G   1% /dev
tmpfs           364M  1.5M  363M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            1.8G   76K  1.8G   1% /run/shm
none            100M   48K  100M   1% /run/user
/dev/md0        8.2T  2.6T  5.6T  32% /media/bensley/9TB-Array

Previous page: Last Login
Next page: MOTD Script