Differences between revisions 5 and 6
Revision 5 as of 2016-02-26 14:10:57
Size: 963
Comment:
Revision 6 as of 2016-02-26 14:22:30
Size: 1098
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
== Install the `mdadm` package==
== Install the `mdadm` package ==
Line 4: Line 6:
apt-get install mdadm root@localhost:~# apt-get install mdadm
Line 6: Line 8:
== Create the RAID1 array== == Create the RAID1 array ==
Line 9: Line 11:
mdadm --zero-superblock /dev/hda /dev/hdc
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/hd["ac"]1
root@localhost:~# mdadm --zero-superblock /dev/hda /dev/hdc
root@localhost:~# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/hd["ac"]1
Line 14: Line 16:
mkfs.ext3 /dev/md0 root@localhost:~# mkfs.ext3 /dev/md0
Line 16: Line 18:
Add entry to fstab: == Add entry to `/etc/fstab`: ==
Line 20: Line 22:
Create mdadm config file: == Create mdadm config file: ==
Line 22: Line 24:
panther:~# cat /etc/mdadm/mdadm.conf root@localhost:~# mdadm --detail --scan /dev/md0 >> /etc/mdadm/mdadm.conf
DEVICE /dev/hda1 /dev/hdc1
Line 24: Line 27:
DEVICE /dev/hda1 /dev/hdc1
Line 26: Line 28:
Note that the array is actually started in /etc/rc0.d/S50mdadm (via mdadm -A -s)  or mdrun command
Note that the array is actually started in /etc/rc0.d/S50mdadm (via mdadm -A -s) or mdrun command

The example below shows how to create a software RAID1 array on Debian systems. Disk partitions /dev/hda1 and /dev/hdc1 will be used as the member of the RAID arrays.

Install the `mdadm` package

root@localhost:~# apt-get install mdadm

Create the RAID1 array

Create disk partitions with type 0xfd.

root@localhost:~# mdadm --zero-superblock /dev/hda /dev/hdc
root@localhost:~# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/hd["ac"]1

Create filesystem (i.e. ext3) on RAID1 block device (md0)

root@localhost:~# mkfs.ext3 /dev/md0

Add entry to `/etc/fstab`:

/dev/md0 /home ext3 noatime,rw 0 0

Create mdadm config file:

root@localhost:~# mdadm --detail --scan /dev/md0 >> /etc/mdadm/mdadm.conf
DEVICE /dev/hda1 /dev/hdc1
ARRAY /dev/md0 devices=/dev/hda1,/dev/hdc1 level=1 num-devices=2 auto=yes

Note that the array is actually started in /etc/rc0.d/S50mdadm (via mdadm -A -s) or mdrun command