Linux Mint Raid 0

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Slimmons
Level 1
Level 1
Posts: 12
Joined: Wed Mar 06, 2013 2:50 am

Linux Mint Raid 0

Post by Slimmons »

There is another forum post about setting up raid 0 on Linux Mint, but it is hard to follow and is very specific to the person asking the question. Can anyone give simple instructions on partition sizes, boot loader locations, and mdadm commands? For the sake of simplicity, let's assume I would like to raid 0 two 1TB HDD's.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Linux Mint Raid 0

Post by catweazel »

I'll do that for you, but you'll have to wait a little while. I'm testing Mint 15 at the moment, and the instructions I have to prepare won't be short.

In the meantime, do you have a spare disk that you can install Mint to? One that isn't going to be part of your RAID setup? The trick is to install Mint to that disk then rsync the installation over to the RAID set. So, if you have a disk spare, install Mint on it now.

Edit: Writing it all up now.
Last edited by catweazel on Wed Mar 06, 2013 3:32 am, edited 1 time in total.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
Slimmons
Level 1
Level 1
Posts: 12
Joined: Wed Mar 06, 2013 2:50 am

Re: Linux Mint Raid 0

Post by Slimmons »

I think so, thanks for the help. I'll get that disk started. Does it have to be any specific size, since I'm using two 1tb hdd's? I have a spare 320gb hdd, will that be ok?
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Linux Mint Raid 0

Post by catweazel »

Ok, you should have Mint installed on a spare HDD. I'll assume that it's sdd and that the two disks you want to RAID are sda and sdb. You'll have to adjust the instructions to match your drive setup. I'll also assume that your two disks have no partitions and are merely all unallocated space. Lastly, I assume you're installing Cinnamon. If you're installing MATE, change gedit in the commands below to pluma.

First, don't set any RAID options in BIOS. They're not needed. Set the ports to AHCI.

With all HD's connected, start the machine and boot into the Mint you've installed on sdd. Install mdadm:

Code: Select all

$ sudo apt-get install mdadm
The install script will ask you about email. Choose "No configuration".

Next, setup the partitions:

Code: Select all

$ gksu gparted
Choose either of the two disks you want to RAID. I assume /dev/sda. Create an msdos partition table on /dev/sda. You'll find instructions here.

I run without swap so I don't do this next step. Create a primary partition (Instructions) and set it to a size equal to half your RAM plus half again just in case. Make sure the partition is marked as 'linux swap'.

Next, create a primary partition (I use the entire disk) on the same device and mark it as 'unformatted'. I don't see the point in partitioning a RAID0 set because if the array goes down you've lost the lot anyway.

Apply the changes (Instructions).

At this point you have one device with these partitions:
/dev/sda1 (marked as swap, unformatted)
/dev/sda2 (unformatted)

Now, that last huge partition you created on /dev/sda2, change its flag to 'raid' (Instructions)

Apply the changes again then quit back to the terminal. Next, mirror the partition table from /dev/sda, which you just partitioned, over to the other disk in the RAID set, /dev/sdb:

Code: Select all

$ sudo sh -c "sfdisk -d /dev/sda | sfdisk /dev/sdb"
At this point you have two separately partitioned devices with these partitions:
/dev/sda1 (marked as swap, unformatted)
/dev/sda2 (unformatted)
/dev/sdb1 (marked as swap, unformatted)
/dev/sdb2 (unformatted)

Now we create the RAID0 set and capture the configuration information:

Code: Select all

$ sudo mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sd[ab]2
$ sudo sh -c "mdadm -Ds >> /etc/mdadm/mdadm.conf"
Next, create the swap and do the deed to /dev/md0:

Code: Select all

$ sudo mkswap /dev/sda1
$ sudo mkswap /dev/sdb1
$ sudo mkfs.ext4 /dev/md0
Now we mount the RAID0 set. We'll use /mnt because Mint uses /media and I don't want to go creating directories on your filesystem, so:

Code: Select all

$ sudo mount /dev/md0 /mnt
Now we rsync the current installation to the RAID set:

Code: Select all

$ sudo rsync -avx / /mnt/
/ is the root of the Mint you installed on the spare drive and booted to at the start of this tutorial.

Now we need to get the UUIDs for /dev/md0 (the RAID set), and for each disk in the set:

Code: Select all

$ sudo blkid
We have to do this because both disks in the set will have to be mounted before we can mount the RAID set. so, you should have a list that looks similar to this:

Code: Select all

/dev/sda1: UUID="fcb1b870-206c-9606-d2b6-f7ece3af251c" UUID_SUB="7983c3c6-861c-f131-fdcd-0731215a615f" LABEL="fsck-me-dead:0" TYPE="linux_raid_member" 
/dev/sdb1: UUID="fcb1b870-206c-9606-d2b6-f7ece3af251c" UUID_SUB="0c4ab68d-2366-ad4f-8943-4bad2a82ca59" LABEL="fsck-me-dead:0" TYPE="linux_raid_member" 
/dev/sdc1: LABEL="128GB_HDD" UUID="0002e9d5-5d5c-450e-82ca-9fdbd7b6c779" TYPE="ext4" 
/dev/md0: UUID="bd9f2f44-96e6-4647-b0f4-af22718a7faa" TYPE="ext4" 
It might be easier if you open another terminal session and do sudo blkid there so you can see the information easier.

Code: Select all

$ gksu gedit /mnt/etc/fstab
Now the tricky bit... your fstab will have a UUID for / (root). replace that UUID with the UUID listed above from the blkid command that belongs to /dev/md0. So, in my case I would replace the UUID for / with this:

Code: Select all

bd9f2f44-96e6-4647-b0f4-af22718a7faa
Don't forget that that line above is my UUID, not yours. It's an example only.

Next, locate the UUID for swap in your fstab and replace that UUID with the UUID from /dev/sda1. Do the same for the other swap partition using the UUID from /dev/sdb1. I can't give you an example here because, as I said, I don't use swap.

If you've been following this and making sense of it you'll be right in suspecting that we have created two unformatted partitions that have the same UUID. That is, the UUID for /dev/sda1 is the same UUID for /dev/sdb1.

Now we have to chroot into the Mint we just copied to the RAID set so we can get it to boot by setting up GrUB:

Code: Select all

$ for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done
$ sudo chroot /mnt
$ update-initramfs -u
$ dpkg-reconfigure grub-pc
Once you're in there, your command line prompt will change colour. Mine goes red.

A text-based dialog will open. Deselect the default entry and select /dev/md0. You do this by pressing the spacebar. When the RAID set has been selected, press tab then press enter on Ok.

If all went well, you can exit the chroot:

Code: Select all

$ exit
$ for i in /dev/pts /dev /proc /sys; do sudo umount /mnt$i; done
Shut the machine down and remove that spare drive you first installed to. Start the machine up again and you should see your shiny new RAID set announced by GruB as /dev/md0. You can breathe and smile now if you like, but with me being a grumpy old bugger I skip that last step and kick the cat instead.

There will be some minor housekeeping you'll have to do. I can't recall what it was I had to do. I think nemo complained. well, something did. All I did was point it in the right direction by setting the correct path. You'll know what I mean when the errors pop up. There's only one or two and they're minor, they're also due to the rsync we did, fyi. Once you've set the right details it should all run like a bought one.

That's it, I'm sure. All done. I don't think I missed anything. And all thanks to mintybits for his original article here, whose clues I pinched.

Edit: Clarified how to deal with swap.
Last edited by catweazel on Wed May 01, 2013 1:40 am, edited 4 times in total.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
Slimmons
Level 1
Level 1
Posts: 12
Joined: Wed Mar 06, 2013 2:50 am

Re: Linux Mint Raid 0

Post by Slimmons »

Hey, I got through everything very successfully until "sudo blkid". Just for clarification on this insanely useful tutorial, you said that the two swap partitions (from sda1, sdb1) would have the same UUID, and on Minty's post he says they don't, and in your fstab file under swap you just list both UUID's. That's what I did on mine, and the rest following your tutorial, and holy crap........I'm completely set up now. I did hit one minor snag (probably user error). When I first did the "for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done" command, it listed several things, and said that none were mounted. I rebooted the computer, and then it worked fine, and everything is great. If you wouldn't mind either editing your post to show the swap UUID's would be two, or telling how to get it to raid0 them together, that would be awesome. Thanks again, you are quite literally "the shit"!
Slimmons
Level 1
Level 1
Posts: 12
Joined: Wed Mar 06, 2013 2:50 am

Re: Linux Mint Raid 0

Post by Slimmons »

Was one of the minor details that didn't work immediately, that mounted USB drives won't open? For some reason when I connected my USB HDD to put my files on my new Mint install it won't let me open it, saying "The location is not a folder". I've looked around, and asked on a couple of forums, and nobody has posted a response, or the solution wasn't correct for this situation. I can get into the drives if i run as root, but then I can't access any of the files once they are on the Mint machine unless I run everything as root. I moved my music to the music folder, and I have to run Banshee as admin to play them. Any ideas? (If this isn't one of the problems that you faced after the Raid 0 config, I've already opened another ticket about this.)
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Linux Mint Raid 0

Post by catweazel »

Slimmons wrote:If you wouldn't mind either editing your post to show the swap UUID's would be two
Yes, you're right. Two UUIDs. The swap partitions are formatted separately. Sorry about that. I'll fix it.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Linux Mint Raid 0

Post by catweazel »

Slimmons wrote:Was one of the minor details that didn't work immediately, that mounted USB drives won't open? For some reason when I connected my USB HDD to put my files on my new Mint install it won't let me open it, saying "The location is not a folder". I've looked around, and asked on a couple of forums, and nobody has posted a response, or the solution wasn't correct for this situation. I can get into the drives if i run as root, but then I can't access any of the files once they are on the Mint machine unless I run everything as root. I moved my music to the music folder, and I have to run Banshee as admin to play them. Any ideas? (If this isn't one of the problems that you faced after the Raid 0 config, I've already opened another ticket about this.)
Run your file manager as root using gksu rather than sudo, then give yourself permissions to the folders and drives by right-clicking. select Properties, then select Permissions.

I can't recall if permissions was one of the issues. I'm not a computer, you see. At 84 years of age the information has to be punched into me more than once before it sticks.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
Slimmons
Level 1
Level 1
Posts: 12
Joined: Wed Mar 06, 2013 2:50 am

Re: Linux Mint Raid 0

Post by Slimmons »

Haha, well I'll look into that once I'm home, and I'll let you know. Once again thanks for all of the help!
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Linux Mint Raid 0

Post by catweazel »

Slimmons wrote:Haha, well I'll look into that once I'm home, and I'll let you know. Once again thanks for all of the help!
I didn't write it for your benefit. I wrote it for mine in case I forget :mrgreen:

Anyway, cheers and all the best. It's sort of exhilarating to see md0 listed in GrUB. I look at it and think, "Gee! I did that!".
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
Slimmons
Level 1
Level 1
Posts: 12
Joined: Wed Mar 06, 2013 2:50 am

Re: Linux Mint Raid 0

Post by Slimmons »

In case anybody else finds this post, and runs into the same problem as me, here's the link to my new post
http://forums.linuxmint.com/viewtopic.php?f=90&t=127725
Slimmons
Level 1
Level 1
Posts: 12
Joined: Wed Mar 06, 2013 2:50 am

Re: Linux Mint Raid 0

Post by Slimmons »

Bleh, looks like I might have to repeat the entire process again. I can't get any thumb drives or mounted hard drives (hot swap, or USB) to open without requiring root access, and no permissions will change on the machine. It's funny because the reason I switched to Mint was because I had to rebuild my windows machine. Searched for two days with no answers on this forum or ubuntu forum. I'll wait till tomorrow to format/try again.
trancephorm

Re: Linux Mint Raid 0

Post by trancephorm »

Thanks for this tutorial. I was successful, but not until I realized two things... It's essential to stop any previous raid set on the disks before you can proceed and it is done with mdadm -S /dev/mdxxx. Previous raid sets may exist because of previous attempts of making it work :)

And in the end, I had to replace "quiet splash" in /mnt/etc/default/grub file, with just "nomodeset"

Also, I did one thing also, along with that replacement, that is I checked /dev/sda1 and /dev/sdb1 along with /dev/md0 in "dpkg-reconfigure grub-pc", but I believe nomodeset did the job.

Happily running soft RAID0 now, I was thinking I wouldn't make it when I saw blinking cursor on boot... Hope this tips will help a bit to someone struggling with same problems.
DeMus

Re: Linux Mint Raid 0

Post by DeMus »

I am also trying to get Mint on Raid 0, but when I see what I have to do to get it working I might as well not even start with it. Isn't there a simpler way to do this? Isn't it just possible to create the correct partitions on both disks, join them using mdadm and do the install? If not, why not? Why do these things in Linux still have to be so complicated?
Ubuntu had the alternate install iso but stopped making them since only 0.8% was using raid. Now we get this long list of codes we have to use to make it work. It's a step backwards, isn't it?

Using an extra disk in my computer is difficult. What I want to do is this:
sda and sdb: swap and / raids, plus a separate /boot partition
sdc and sdd: /home and /music raids.
I have 4 disks and want to use all of them.

Mr Catweazle, if you are reading this, since you seem to know your way around Linux very well, please try to find an easier way to do this and if possible write it down step by step so even the lesser gods (like me) can use it. Thank you so much.
Locked

Return to “Beginner Questions”