The Silent Hobo
Member
- Reaction score
- 3
- Location
- Oklahoma City, OK
Setting up Raid 1 (mirror) on Linux Mint XFCE (or any debian based linux)
boot into debian linux distro from live disk or USB drive
This is done with 2 500 SATA drives – Using mine as a small cheap file server
Open terminal
sudo su
dd if=/dev/zero of=/dev/sda bs=1048576
dd if=/dev/zero of=/dev/sdb bs=1048576
the DD command will clean the hard drives off of anything.
cfdisk /dev/sda
Create a new 500 MB partition or 1 gig partition at the beginning
Move the selection bar into the Free Space
Create a new partition with the remaining space
Change the type of this partition to FD.
Write the changes
Quit cfdisk
cfdisk /dev/sdb
Create a new 500 MB partition or 1 gig at the beginning
Move the selection bar into the Free Space
Create a new partition with the remaining space
Change the type of this partition to FD.
Write the changes
Quit cfdisk
cfdisk -P s /dev/sda
To get last sector #
apt-get install mdadm
mdadm --create /dev/md0 --level=raid1 --raid-devices=2 /dev/sda2 /dev/sdb2
mkfs.ext3 /dev/md0
ln /dev/md0 /dev/sde
mkfs.ext3 /dev/sda1
mkfs.ext3 /dev/sdb1
That command will copy the boot partition over to the sdb drive so if sda goes down, the system will still start up.
Install Debian based Linux
Start the installer, it has an icon on the desktop. When you get to the 'Allocate drive space' dialog, choose the 'Specify partitions manually' option. Click the /dev/sda1 partition, choose 'Change...' and fill out the following options:
Use as: Ext3 journaling file system Format the partition: No (do not check the checkmark) Mount point: /boot
Click the /dev/md0 partition, choose 'Change', and fill it out like this:
Use as: Ext3 journaling file system Format the partition: No (do not check the checkmark Mount point: /
There's also a dropdown for 'Device for boot loader installation'. Make sure that /dev/sda is selected there. Click the 'Install Now' button, and 'Continue' on any confirmation dialogs you might get. Fill out the rest of the install questions and sit back while the OS installs itself.
When the installer is done, do*not*reboot the system yet (choose 'Continue testing'). Go back to your terminal screen and prepare the boot partition:
mkdir /raid
mount /dev/md0 /raid
mount /dev/sda1 /raid/boot
mount --bind /dev /raid/dev
mount -t devpts devpts /raid/dev/pts
mount -t proc proc /raid/proc
mount -t sysfs sysfs /raid/sys
mount -o bind /etc/resolv.conf /raid/etc/resolv.conf
chroot /raid
apt-get install mdadm
nano /etc/mdadm/mdadm.conf and remove the / from between md and the 0
hit control X and save the file
then type mdadm --assemble /dev/md0
then type exit: then
dd if=/dev/sda of=/dev/sdb count=(last sector # here)
That command will copy the boot partition over to the sdb drive so if sda goes down, the system will still start up.
Reboot and it should boot up to the OS with no problem
Checking the RAID
A useful command that will tell you the status of the RAID is*cat /proc/mdstat
It's output is something like:
md0 : active raid1 sda2[0] sdb2[1] 62468672 blocks [2/2] [UU]
The UU means both RAID1 components are 'Up'. If one disappears, it's 'U' will change to and underscore ('_').
Most of the info was taken from
http://www.michielovertoom.com/linux/ubuntu-software-raid/
With updates/modifications from me (like size of boot partition)
I got this working in a VM setting after toying with it for 2 days and doing loads of research. Figured it might help someone. Even if it's just to learn how.
~Joshua
boot into debian linux distro from live disk or USB drive
This is done with 2 500 SATA drives – Using mine as a small cheap file server
Open terminal
sudo su
dd if=/dev/zero of=/dev/sda bs=1048576
dd if=/dev/zero of=/dev/sdb bs=1048576
the DD command will clean the hard drives off of anything.
cfdisk /dev/sda
Create a new 500 MB partition or 1 gig partition at the beginning
Move the selection bar into the Free Space
Create a new partition with the remaining space
Change the type of this partition to FD.
Write the changes
Quit cfdisk
cfdisk /dev/sdb
Create a new 500 MB partition or 1 gig at the beginning
Move the selection bar into the Free Space
Create a new partition with the remaining space
Change the type of this partition to FD.
Write the changes
Quit cfdisk
cfdisk -P s /dev/sda
To get last sector #
apt-get install mdadm
mdadm --create /dev/md0 --level=raid1 --raid-devices=2 /dev/sda2 /dev/sdb2
mkfs.ext3 /dev/md0
ln /dev/md0 /dev/sde
mkfs.ext3 /dev/sda1
mkfs.ext3 /dev/sdb1
That command will copy the boot partition over to the sdb drive so if sda goes down, the system will still start up.
Install Debian based Linux
Start the installer, it has an icon on the desktop. When you get to the 'Allocate drive space' dialog, choose the 'Specify partitions manually' option. Click the /dev/sda1 partition, choose 'Change...' and fill out the following options:
Use as: Ext3 journaling file system Format the partition: No (do not check the checkmark) Mount point: /boot
Click the /dev/md0 partition, choose 'Change', and fill it out like this:
Use as: Ext3 journaling file system Format the partition: No (do not check the checkmark Mount point: /
There's also a dropdown for 'Device for boot loader installation'. Make sure that /dev/sda is selected there. Click the 'Install Now' button, and 'Continue' on any confirmation dialogs you might get. Fill out the rest of the install questions and sit back while the OS installs itself.
When the installer is done, do*not*reboot the system yet (choose 'Continue testing'). Go back to your terminal screen and prepare the boot partition:
mkdir /raid
mount /dev/md0 /raid
mount /dev/sda1 /raid/boot
mount --bind /dev /raid/dev
mount -t devpts devpts /raid/dev/pts
mount -t proc proc /raid/proc
mount -t sysfs sysfs /raid/sys
mount -o bind /etc/resolv.conf /raid/etc/resolv.conf
chroot /raid
apt-get install mdadm
nano /etc/mdadm/mdadm.conf and remove the / from between md and the 0
hit control X and save the file
then type mdadm --assemble /dev/md0
then type exit: then
dd if=/dev/sda of=/dev/sdb count=(last sector # here)
That command will copy the boot partition over to the sdb drive so if sda goes down, the system will still start up.
Reboot and it should boot up to the OS with no problem
Checking the RAID
A useful command that will tell you the status of the RAID is*cat /proc/mdstat
It's output is something like:
md0 : active raid1 sda2[0] sdb2[1] 62468672 blocks [2/2] [UU]
The UU means both RAID1 components are 'Up'. If one disappears, it's 'U' will change to and underscore ('_').
Most of the info was taken from
http://www.michielovertoom.com/linux/ubuntu-software-raid/
With updates/modifications from me (like size of boot partition)
I got this working in a VM setting after toying with it for 2 days and doing loads of research. Figured it might help someone. Even if it's just to learn how.
~Joshua
PS: Just got this working on a dell optiplex 330 with 2 500 gig hard drives and everything works with linux mint 17 xfce

Last edited: