RAID1 on linux with mdadm – Part2

Continued from RAID1 on linux with mdadm – Part1:

Performance results

Without any encryption

$time sudo dd if=/dev/zero of=testfile bs=1G count=10
10+0 records in
10+0 records out
10737418240 bytes (11 GB) copied, 77.2889 s, 139 MB/s

real 1m17.517s
user 0m0.000s
sys 0m22.230s

Truecrypt AES partition

$ time sudo dd if=/dev/zero of=testfile bs=1G count=10
10+0 records in
10+0 records out
10737418240 bytes (11 GB) copied, 78.6724 s, 136 MB/s

real 1m18.837s
user 0m0.000s
sys 0m21.750s

Mark listed device as faulty and remove

This will mark /dev/sdb1 and /dev/sdb2 as faulty devices and will remove them from the array.

$sudo mdadm /dev/md_d0 --manage --fail /dev/sdb1 --remove /dev/sdb1
$sudo mdadm /dev/md_d1 --manage --fail /dev/sdb2 --remove /dev/sdb2

To re-add the removed device


$sudo mdadm /dev/md_d0 --manage --re-add /dev/sdb1
$sudo mdadm /dev/md_d1 --manage --re-add /dev/sdb2

Stop all the arrays


$sudo mdadm --stop --scan

This will shut down all arrays that can be shut down (i.e. are not currently in use).

Populating the mdadm.conf


$sudo /bin/bash -c echo 'DEVICE /dev/hd[a-z] /dev/sd*[a-z]' >> mdadm.conf
$sudo /bin/bash -c "mdadm --examine --scan --config=mdadm.conf >> mdadm.conf"

This will find arrays which could be assembled from existing IDE and SCSI whole drives (not partitions), and store the information in the format of a config file.

For scanning partitions


$sudo /bin/bash -c "mdadm --examine --scan --config=partitions >> mdadm.conf"

or

$sudo /bin/bash -c "mda0dm -Esc partitions >> mdadm.conf"

This will scan the drives for partitions by reading /proc/partitions and then scanning the partitions for RAID superblocks.

Assemble and start all arrays listed in the config file


$sudo mdadm --assemble --scan

This will assemble and start all arrays listed in the standard config file(mdadm.conf).

Scan and assemble md0


mdadm -Ac partitions -m 0 /dev/md0

Scan all partitions and devices listed in /proc/partitions and assemble /dev/md0 out of all such devices with a RAID superblock with a minor number of 0.

Short-cut to auto-detect arrays if kernel supports


sudo mdadm --auto-detect

Request that the kernel starts any auto-detected arrays. This can only work if md is compiled into the kernel — not if it is a module. Arrays can be auto-detected by the kernel if all the components are in primary MS-DOS partitions with partition type FD.

Increasing number of drives in the array


sudo mdadm /dev/md1 --grow -n 3

Leave a Reply

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