I've been searching on the internet for quite some time to find a solution. I've been trying to install Ubuntu Desktop on a new computer build. I would like to install ubuntu desktop on a ssd and setup my 4 hdds in a raid 10 array. I mainly want to use it as a media server, but want the desktop version to possibly run windows programs also. Is there any info you could suggest on out to install ubuntu with the os on the ssd and to keep all my files in a raid 10 array? Also my Asus Motherboard supports fakeraid would it be suggested to use that or ubuntu software raid? Thanks.
1 Answer
First off, let me point out that Ubuntu Server supports adding RAID partitions already during installation. But since you want to install Ubuntu Desktop, let's focus on that.
So if I got you correctly, you want the system itself to be installed on the SSD drive (not RAID), but your media files etc. on a RAID partition. So then, I would setup two partitions:
- one normal partition on your SSD, say
/dev/sda1
, which is mounted on/
(that is where your system resides); - and one software RAID partition (distributed on your four HDDs), say
/dev/md0
, which is mounted on/home
(that is where your user's files reside).
Since Ubuntu Desktop does not support setting up RAID partitions during the installation process, I would proceed as follows.
Install a perfectly normal Ubuntu Desktop with a single partition on your SSD (plus, maybe, a swap partition that you could also install on your SSD - see this AskUbuntu thread for a discussion on swap partitions on SSDs; in a nutshell, it is fine).
Once your entire Ubuntu system is set up on your SSD drive, you still have four big empty HDDs there. From your new Ubuntu system you can now comfortably set up a software RAID using these four HDDs. For this, we will need two pieces of software:
parted
to partition your HDDs, andmdadm
to set up your softwate RAID.sudo apt-get install parted mdadm
Next we use
parted
to partition the four HDDs. Each HDD will contain a single partition. Let's say your four HDDs are known to the system as/dev/sdb
,/dev/sdc
,/dev/sdd
, and/dev/sde
. Issue the following commands to set up a single big RAID-ready partition on/dev/sdb
. This will erase any data on/dev/sdb
:sudo parted /dev/sdb mklabel gpt sudo parted -a optimal -- /dev/sdb mkpart 2048s -8192s sudo parted /dev/sdb set 1 raid on
Repeat the procedure for
/dev/sdc
,/dev/sdd
, and/dev/sde
. We intentionally leave 8192 sectors free at the end to avoid headaches if ever you come into the situation where you have to exchange one of the HDDs, to compensate for small size differences that exist between drives. We intentionally leave 2048 sectors free at the beginning to guarantee an optimal alignment.Now that we have four big equally-sized partitions, we're all ready to create a software RAID. We will use the
mdadm
utility for that. There are excellent (and detailed) tutorials in the Internet on how to do this, so it wouldn't make sense for me to write that up here. Instead, I recommend this ArchWiki article which explains how to do it. It is aimed at Arch Linux, but it will work on Ubuntu just fine, and you'll learn a lot of things along the way. (There is also this ubuntuusers article which is good and aimed specifically at Ubuntu, but it is in german - however you could use Google Translate if you like, and, anyway, the commands are universal; sorry, the corresponding article on the english page is, surprisingly, outdated). Mainly, you need to (a) assemble the RAID array usingmdadm
, and (b) format the RAID filesystem with your favorite filesystem type, using a tool such asmkfs.ext4
.Finally, you want to mount your
/dev/md0
device on/home
, and make that persistent. That way, in the future, all your home directories will be on the RAID, while your system resides on your SSD!a. First, make sure that you can mount your RAID:
sudo mkdir -p /mnt sudo mount /dev/md0 /mnt
If that works fine, unmount it again:
sudo umount /mnt
...now we are only left with making this our future
/home
. Since we will fiddle around with/home
here, I recommend not being logged in as a user in X.b. Log out from your X Session (such that you're back at the graphical login screen).
c. Type Ctrl+Alt+F1
c. Log in as your normal user on this non-graphical login screen.
d. Issue the following set of commands:
sudo mv /home /home.bak sudo mkdir /home sudo mount /dev/md0 /home sudo rsync -av /home.bak/ /home
Make sure you don't miss the slash at the end of
/home.bak/
. Do type/home.bak/
and NOT/home.bak
. The subtleties ofrsync
... You can delete/home.bak
some day in the future, but there's no hurry. Let's first make sure everything works fine.e. Type Ctrl+Alt+F7 to get back to the graphical login, and, well, login to make sure it's all working :)
f. If everything is fine, the last thing to do is to make the changes persistent, so that your
/home
will always be your RAID in the future. Open/etc/fstab
with your favorite text editor asroot
. For instance, typesudo nano /etc/fstab
Add the following line (assuming you used
ext4
as a filesystem, otherwise change accordingly):/dev/md0 /home ext4 defaults 0 2
That's it! Have fun with your media server :)
-
Cool. Thanks for the response. I have seen some videos and read some info about this. I'm new Linux. I grew up using windows and this is my very first computer build. I would like to ask another question. How do I open up a command line in Ubuntu Desktop to install parted and mdadm? Jan 23, 2014 at 0:42
-
Hi, just open a terminal (command line interface) by hitting Ctrl+Alt+T. If this is your very first computer build and you are new to Linux, it definitely makes sense to first make a standard Ubuntu installation on your SSD, then configure the RAID later, exactly as I explained in my post. If my post was helpful to you, please consider marking the answer as accepted. :) Jan 23, 2014 at 9:14