bluedrag (bluedrag) wrote,

How to set up a software RAID on Linux

# figure out how the new drives are called:
lsscsi -s
# or
sudo lshw -C disk

# let's say it's /dev/sdb and /dev/sdc
# create partitions as needed
sudo fdisk /dev/sdb
sudo fdisk /dev/sdc

# create the RAID (in this case --level=1 => RAID1)
sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1 --verbose

# check on its status
sudo mdadm --detail /dev/md0
watch -d cat /proc/mdstat

# format
sudo mkfs.ext4 /dev/md0
# optional -- configure to use 99% of capacity
sudo tune2fs -m 1 /dev/md0

# define mount point: add the following line to /etc/fstab:
# /dev/md0 /mnt/raid ext4 defaults 1 2
sudo mount -a

# finally, configure the email notifications
# assuming you are running postfix, add a line to /etc/aliases:
# root: your@email
# test:
sudo mdadm --monitor --scan --test --oneshot
Tags: linux
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.