Have you ever been interested in running your ubuntu server in raid?
Well last summer I turned my box into raid 0 with 2x 500gb drives and this is how I did it.
1. 2 Hard drives (Works best if they are identical)
2. Instsall ubuntu-desktop, yes I talk about not liking the GUI, but I find when trying to complete part 7 of this guide it makes it alot easier.
- sudo apt-get install ubuntu-desktop
3. Boot with your Ubuntu Live CD (If you don’t know how read my guide on How to install a server though it is for USB only)
4. type the following commands to update your repo’s and install the software required for raid.
- sudo apt-get update
- sudo apt-get install mdadm
5. Partitioning the drives
Type “gparted” to start the partitioning manager and follow the next few steps
- Create a 500 MB partition on the for your first drive /dev/sda should be the first one if not it would be /dev/sdb
- Create the main (“/”) partition on both of the drives, the size of this should be the remaining free space minus whatever you used in the partitions above, remember that this and the next partitions you make need to be of equal sizes on both drives
- This last partition is for your swap space on both drives. Create them with the same size as your RAM.
6. Create the actual raids
- sudo mdadm –create /dev/md0 –verbose –level=0 –raid-devices=2 /dev/sda2 /dev/sdb1
- sudo mdadm –create /dev/md1 –verbose –level=0 –raid-devices=2 /dev/sda3 /dev/sdb2
7. Format the new raids
- sudo mkfs.ext4 /dev/md0
- sudo mkswap /dev/md1
8. Start the installer
It should be on the desktop (WHAT EVER YOU DO DO NOT RESTART AFTER COMPLETING THIS SECTION!)
Complete the steps until you get to partitioning, once you are there choose advanced at the bottom
- Pick “/dev/md0″ and click change, pick ext4 in the dropdown menu, then pick to format followed by mount point “/”.
- Pick “/dev/md1″ and click change and pick swap
- Pick the 500MB partition, followed by clicking change to: ext4, format, “/boot”
When you arrive at the summary page, click advanced at bottom right and pick the drive where the 500MB partition is located, this is where the grub boot loader will be installed on your system.
The pair partitions will show you in black as unknown with a warning sign, ignore this.
9. Before we reboot we need to edit some files on our box so it will automount everytime we reboot
- sudo mount /dev/md0 /target/
- sudo mount –bind /dev/sda1 /target/boot/
- sudo mount –bind /dev/ /target/dev/
- sudo mount –bind /sys/ /target/sys/
- sudo mount –bind /proc/ /target/proc/
- sudo chroot /target
- sudo apt-get remove dmraid
- sudo apt-get install mdadm
- sudo grub-install /dev/sda
10. Reboot and remove your usb drive
If you did everything correctly you should be booting into your new raided ubuntu server!
- Ensure you have the correct cables when connecting drives to a raid card if you do decide to do it this way!