Preparing a RAID system of 2 disks and 2 partitions

In the following examples we are going to use sdb and sdb for the disc to use in the RAID. Adapt it to your situation.

Create the partitions

fdisk /dev/sdb

Set the RAID1 system on the 2 partitions

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1

mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sdb2 /dev/sdc2

 

Check the RAID-DEVICES

cat /proc/mdstat

 

Make the file system

mkfs.ext3 /dev/md0

mkfs.ext4 /dev/md1

 

Mount the disks

mkdir /mnt/md0

mkdir /mnt/md1

mount /dev/md0 /mnt/md0/

mount /dev/md1 /mnt/md1/

 

Copy the data of Home

cd /home

tar c * | tar x -C /mnt/md1

 

Find the UUID of the 1st partition

blkid

/dev/md1: UUID="3968404e-6571-4671-a157-9113a9f2fcba" TYPE="ext4"

 

Make md1 be the home directory

emacs /etc/fstab

# /home was on /dev/sda9 during installation

UUID=3968404e-6571-4671-a157-9113a9f2fcba /home ext3 defaults 0 2