Install Software RAID in Linux System

Install Software RAID in Linux System

Table of Contents

  • Benefit
  • Prepare
  • install and configure mdadm
  • finished


1 Benefit

RAID can provide stable, speed and security for your data access, but not at the same time. We need different performance at a different scenario, and the above three traits that I mentioned, are trade-off factors in real apply, some time we sacrifice one to achieve another. In my desktop work station, what I really need is the speed all the time.

That's the RAID-0. Here is my disks, one SSD as the system disk for ubuntu, and two additional 1T disks to be an RAID-0 array.

2 Prepare

Plug two disks into the motherboard first, then erase the disk's format use fdisk tool and build one partition for each one with the same size.

In my case, I got two devices, /dev/sdb, /dev/sdc.

sudo fdisk /dev/sdb

# d  .... delete all partition in the hard driver
# n  create one partition for the whole disk
# t  choice fd (linux raid disk) as the disk lable
# w 
# repeat those stops to initial /dev/sdc

3 install and configure mdadm

sudo apt-get update
sudo apt-get install mdadm


sudo mdadm --create /dev/md0 --level=0 -n 2 /dev/sdb1 /dev/sdc1

# add the config to /etc/mdadm/mdadm.conf config file
sudo mdadm --detail --scan >> /etc/mdadm/mdadm.conf

# partition /dev/md0 disk, and create a partition /dev/md0p1
fdisk /dev/md0

# format disk
mkfs.ext4 /dev/md0p1

# mount /dev/md0p1 automatically after reboot
# config /dev/fstab

4 finished

reboot the system, and adjust the disk mount parameters. In my case, the /dev/md0 device name changed after I reboot, so I need to sync with the /dev/fstab.

Comments

Popular posts from this blog

Bluedroid stack in android

How to setup a NAT server?

Network programming in elisp