How to create a simple Raid 0 on Ubuntu 18.04?

(First time poster here, please let me know if this is the wrong place to put this, I didn’t see any kind of help channel but I might have missed it)

Level of Experience:
Hello, I have been primarily using Windows as my main OS for a while now. Though I do use Linux occasionally, for some server applications (Minecraft Gamer servers and UnRaid), and have taken a basic Linux administration course with my local community college. So I am by no means well versed in Linux, but I would describe myself as sharp enough to be dangerous.

Context & Question:
But to get to the point. I have a windows machine I want to install Linux (Ubuntu 18.04) on to experiment using Linux for Media PC tasks since it will be connected to my living room TV (and also just generally messing around in Linux). When I first built the computer I had some old hard drives lying around (about 3 of them) and thought it would be fun to stripe them together in a software raid 0 (windows) for shits and giggles. Now I never stored anything important on those drives since I knew the chance of failure was pretty considerable (just game installs), but I was pretty impressed with the performance I was getting. Now my question is what would be a good way to put these drives in a software raid 0 (Hardware raid is not an option, old MoBo) that would be mounted upon start up. I did a little bit of googling but wasn’t sure if the guides/options I was finding were very good. So I just wanted to see what kind of feedback I got here.

The Arch wiki should be applicable - only thing that will change is package names in Ubuntu.

You can go for MDADM - this is probably the most popular solution or do something like a BTRFS RAID.

A few months back I had a 4x 128GB SSD stripe for my game drive. I did this with BTRFS for ZSTD compression. Performance was really good - but I have since upgrade to a 1tb NVME so that was taken out. The NVME gives me better real world performance than that stripe gave me, even though the difference is marginal.

1 Like

This may be a dumb question, and might be solved with a quick google search, but whether I was using MDADM or BTRFS, what would be a good way to get that to mount upon boot up? As I know there are guides to get a single disk to mount upon start up, but I didn’t know if there was a good way of doing that with an array.

Thank you for the reply btw, I am liking the look of BTRFS. That compression you mentioned also sounds interesting, was it very CPU heavy? I wonder as I am using a rather old phenom ii x4 955 and I don’t have much room in terms of performance.

Ons thing that I would recommend is ZSTD compression - the speed cost is minimal at ZSTD=2 and my game dir currently has a 20% reduction in space. That’s an extra 200gb on a 1tb.

But your mileage will vary depending on game and how good it compresses

With BTRFS you can easily mount the RAID by just referring to the label you gave it when you created it. Nothing special needed further than that.

LABEL=Game /mnt/Game btrfs rw,relatime,compress=zstd:2,ssd,space_cache,defaults 0 0

this was my old mount point for my game drive in fstab.

Thank you! I kinda already knew about BTRFS from some LTT videos I had watched but for some reason didn’t even think about it. I’ll definitely do some reading on it and figure out a good setup (that compression looks really interesting for space savings). Thank you for the help. (=

1 Like

Just did a quick test - I copied game files to my NVME and at a speed of about 700mb’s I was getting a cpu usage of about 20% on my i3-8100.

This isn’t a very scientific method of testing and the 700mb’s limit was on the source drive but to me this is good enough and the performance cost is marginal.

In that case I might take the compression down a notch from your setup, as I don’t think I will be too starved for storage and your i3 (from what I can tell) is about 80 percent (ish) faster than the CPU in the system.

Also another dumb question for you if you have the time, can you change settings like compression or caching after the fact? Or would it require you to rebuild the array?

The “compress=zstd:2” option when you mount it is where you adjust it.

If you change it later the only thing that happens is any new files written to the mount will be compressed using the new setting. If you want to change the compression to all data already on the drive then you can do that using:

btrfs filesystem defragment -r -v -czstd /

Just change “/” to your mount point and the zstd command to the compression level you want.

To see how the compression is affecting a folder you can use a utility called compsize. To get a lighter compression than I have you would do a zstd:1.

Alright thank you for the help, I think I’m definitely going with BTRFS and I think this will be a fun little project while I am in Social Isolation. Thank you again and stay safe (=

1 Like