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.