Difference between revisions of "RAID"

From Vague Hope Wiki
Jump to: navigation, search
(Create)
(GUID type)
Line 30: Line 30:
 
=== GUID type ===
 
=== GUID type ===
  
 +
parted /dev/sda
 +
mklabel gpt
 +
mkpart primary 0GB 3001GB
 +
p
 +
  
 +
https://www.gnu.org/software/parted/manual/html_chapter/parted_7.html#SEC63
  
 
=== Create array ===
 
=== Create array ===

Revision as of 13:41, 12 June 2013

Set up

sudo aptitude install mdadm

Create

Set disc type

For each disc:

sudo fdisk /dev/sdb

n          ; for a new partition
enter
p          ; for a primary partition
enter
1          ; number of partition
enter    ; accept the default
enter    ; accept the default
t          ; to change the type
fd        ; sets the type to be “Linux raid auto detect” (83h)
w         ; write changes to disk and exit

GUID type

parted /dev/sda
mklabel gpt
mkpart primary 0GB 3001GB
p

https://www.gnu.org/software/parted/manual/html_chapter/parted_7.html#SEC63

Create array

sudo mdadm --create --verbose /dev/md0 --level=6 --raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
sudo watch cat /proc/mdstat

mdadm.conf

sudo -i
mdadm --detail --scan >> /etc/mdadm/mdadm.conf

Though the above does not quite work. Make it look more like this: (remove name or get weird md127 issues)

ARRAY /dev/md0 level=raid6 num-devices=4 metadata=1.2 UUID=659ec2c1:6631ccfd:08dbd99b:5bf050a3

Remember: test by rebooting.

Format

sudo mkfs.ext4 /dev/md0

Mount

Add to `/etc/fstab'. 'nobootwait' is IMPORTANT.

/dev/md0 /media/yama ext4 defaults,errors=remount-ro,nobootwait 0 2

Extra

Test email:

sudo mdadm --monitor --scan --test --oneshot

Set the mdadm configuration to send an Email on startup:

sudo vim /etc/default/mdadm

Add the --test parameter to the DAEMON_OPTIONS:

DAEMON_OPTIONS="--syslog --test"

Removing

lsblk
sudo mdadm --stop /dev/md0
sudo mdadm --zero-superblock /dev/sda1
sudo mdadm --zero-superblock /dev/sdb1
sudo fdisk /dev/sda (and delete part)
sudo fdisk /dev/sdb (and delete part)
lsblk

References