I am looking to set up a new server. I can only use Intel 520 Series 240gb MLC ssds or standard Seagate 7200rpm disks.
These are the non negotiable options.

Naturally, as this is going to be running MySQL with its primary task being a MySQL server. As the biggest performance bottleneck being disk I/O, I would prefer to use the SSDs.

I need to have close to 1TB of disk space. Now, RAID5 does not give the best performance and is rumoured to not be best for SSDs, so I am looking at a Raid 10(1+0) setup which would give me 720gb (240gb * 3)

I need to know how I can set this up with Ubuntu 12.04.01 LTS using software raid and to make sure that TRIM support (Discard I think its called in Linux) is enabled for the raid config.

Has anyone don't this successfully? Any howto info and stuff to watch out for and basically what tools to use and so on would be of great assistance.

Ideally, I also need to be able to boot off the SSD raid array.

Can anyone point me in the right direction ?


  • 1
    There recently was a big trouble when using TRIM on SSD in RAID. Bug made TRIM to zero out active files at random. Only Samsung SSDs are said to be affected, but AFAIK that is because only Samsung SSDs were tested. For this, I strongly suggest you to think about using BTRFS RAID10 instead of mdadm or LVM. – Barafu Albino Sep 30 '15 at 7:29

The answer is "it depends" and you should really understand what TRIM does before asserting such an inflexible position.


MD RAID needs specific support to forward DISCARD requests and that hasn't even been proposed until 3.6, therefore the support will not be in the precise kernel. I just looked, it's not there.


SSDs are nice and all, but they are most cost effective when combined with high RPM magnetic storage. For example, use a RAID 1 SSD array to house the filesystem journal while the filesystem is backed by a RAID 10 consisting of 15K disks.


The higher the RPMS, the lower your worst seek time is, random IO loads benefit the most from high RPM backing stores. SQL can be write intensive, so any parity calculation is a bad idea e.g. RAID 4 and 5.

The organization of the RAID and the filesystem is just as important as the backing store.

You can always TRIM your disks manually, weekly is fine to start, you should observe what the performance impact is before running it more frequently. Oh, they will burn out so it would be a good idea to estimate how many write/delete cycles your SSDs have and service the RAID 1 one leg at a time.



I know I'm being a Johnny-come-lately to this question but I'd like to see if I can shed some light on this for anyone searching.

First, @ppetraki's answer is excellent.

The short answer to "Can I RAID SSDs and boot from them" is "Yes!". Here are instructions for 14.04. Instructions for RAID configuration on 12.04.x are identical, but this tutorial using 9.10 has pictures. Following here are some important gotchas and details I had to discover the hard way, through personal experience:

I'm running Ubuntu 12.04.5 with the 3.8 kernel on an MD RAID0 configuration and the SSD-friendly Btrfs filesystem. I run fstrim as a weekly cron.

My extra Btrfs mount options from fstab:


The 3.8 kernel is required if you want to use compress=no as a Btrfs mount option and may also be required for use of fstrim, the manual trim command used for scheduled trim.

You must also manually align partitions (on any multi-partition setup, raid or not) on the SSDs BEFORE booting to the installer because depending on the page size of your SSD, only the first partition will be properly aligned (it took me a while to catch it) and this can severely impact drive lifespan. You can do this from a command prompt within the installer or from a live usb/disc before you attempt installation. Caveat: Do the math yourself. Fdisk will lie about alignment.

Further reading: I think Btrfs can even create its own raid arrays.

Regarding TRIM:

It's arguably unnecessary thanks to overprovisioning

14.04 is the first release to enable TRIM support out-of-the-box but it's trivial to enable on previous distributions, provided you are using kernel 2.6.33+.

Depending on your chosen filesystem, you can enable trim/discard by editing your fstab and setting the appropriate mount option. The difference between doing this and running it via cron is that the first will trim/discard on-the-fly and the second will do it in a lump on a schedule. I use the second.

Does it matter? Supposedly, the online discard (using the mount option) is not wonderfully implemented and is slow so it's "not recommended". I can tell you that my "hdd" (hehe) lights go nuts for 10-20 minutes when the weekly cron job runs but the OS responsiveness is almost completely unaffected.

Booting from the array

Though I don't see this in a quick scan of the ubuntu 14.04 instructions, I had to create an additional primary partition that is NOT part of my raid arrays. Disk 0 has a 500mb primary partition of ext3fs. During installation I told the installer this was to be mounted at "/boot" and I set the bootable flag. The bootloader is then installed here so the OS can start and then mount the RAID. The remaining Disk 0 space is divided between 2 partitions which are later used for the MD arrays that become "/" and "/swap". Disk 1 has the same, but no boot partition. Also, I only created the swap in case I need it sometime and btrfs does not support swapfiles. This partition is never mounted; after installation, I commented it out in my fstab.

Forgive all the edits, just trying to get it all out there.

  • Thank you for this insightful info. I will try this out on my next system deployment – Steed Oct 2 '15 at 6:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.