(SOLVED)setting up raid0 on linux mint 13

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.
Schoza

(SOLVED)setting up raid0 on linux mint 13

Post by Schoza »

hey all
just built a new system and im trying to set up raid0 on it
my build is
gigabyte GA-Z68X-UD5-B3 motherboard
2700k processor
gtx 560ti graphics
8gb patriot viper extreme ram
2x2tb sata 3 hard drive
Last edited by Schoza on Thu Jun 14, 2012 12:32 am, edited 2 times in total.
mintybits

Re: setting up raid0 on linux mint 13

Post by mintybits »

Hi there.
The bios RAID options are intended for Windows. Disable them all.

You will need to boot a live CD and before running the installer you will need to create the RAID-0 on your two 2TB drives. Then you can run the installer and tell it to use the RAID-0.

It is not simple with Mint. You need to create partitions on your 2TB disks, make a RAID-0 with them, then install Mint to the RAID-0 and then configure the new OS before it will boot.

In summary:
You need to boot your live CD
Run gparted to make partitions on one of the 2TB disks, as a minimum one for / and one for swap.
Copy the MBR to the other 2TB disk
Install mdadm
Use mdadm to create a RAID-0 using the two / partitions
Format the RAID-0 device
Run the installer and "Something Else" and choose the RAID-0 device for / and the RAID-0 for the grub bootloader
The installer will probably report an error.
Chroot into the new / and install mdadm, configure mdadm.conf and run "update initramfs -u" and run "dpkg-reconfigure grub-pc"

I don't have time right now to detail this all out but hopefully this summary will help you to search for the details.
Ubuntu has an "alternative installation" iso that has a different installer that will do all of this for you.
Schoza

Re: setting up raid0 on linux mint 13

Post by Schoza »

thank you for ur reply
i will give it a go tonight,
how big do i make the swap file
also i have a 1tb hard drive in my computer do i put a swap file on that as well as the raid drive
mintybits

Re: setting up raid0 on linux mint 13

Post by mintybits »

Hi. If you have a 1TB drive you can make the process simpler by installing Mint to the 1TB first and then copying it to your new RAID-0.
Here's how:

1) Connect your 1TB drive only. Install Mint to it, choose "use entire disk" (assuming it is blank - if not, choose "Something Else" and install it to its own partition). Shut down afterwards.
2) Reconnect the two 2TB drives
3) Boot Mint on the 1TB
4) Install all updates
5) Install mdadm (linux RAID software) in a terminal

Code: Select all

  sudo apt-get install mdadm
choose "No Configuration" for the postfix emailer
6) run gparted and use it to partition ONE of your 2TB disks as follows (see: http://www.dedoimedo.com/computers/gparted.html)
make a note of the disk name. I'll assume it is /dev/sdb for these instructions. Check it.
create an MS-DOS partition table
make one 2GB primary partition of type "linux-swap" (partition #1)
make one primary partition of type "unformatted" using the rest of the space (partition #2)
apply changes
select the 2nd partition and change its flag to "raid" (use the "manage flags" in the "Partition" menu).
quit gparted
7) Copy the partition table to the other 2TB drive. I'm going to assume the other 2TB is /dev/sdc. Check it.

Code: Select all

  sudo sh -c "sfdisk -d /dev/sdb | sfdisk /dev/sdc"
  sudo hdparm -z /dev/sdc
8 ) Now make the RAID-0 device using the large, unformatted partitions

Code: Select all

  sudo mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sd[bc]2
  sudo sh -c "mdadm -Ds >> /etc/mdadm/mdadm.conf"
9) Format the swap areas and the RAID-0

Code: Select all

  sudo mkswap /dev/sdb1
  sudo mkswap /dev/sdc1
  sudo mkfs.ext4 /dev/md0
10) Copy MInt to the RAID-0

Code: Select all

  sudo mount /dev/md0 /mnt
  sudo rsync -vax / /mnt/
11) Edit the RAID-0 Mint fstab file

Code: Select all

  sudo blkid
make a note of the UUIDs for /dev/md0 and for /dev/sdb1 & /dev/sdc1

Code: Select all

  sudo vi /mnt/etc/fstab
and replace the UUID for / with the one for /dev/md0 and replace the UUID for swap with the one for /dev/sdb1, and add a second one for swap identical to the first with the UUID for /dev/sdc1
12) Chroot into the new Mint and configure it for booting

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
and select both sdb and sdc for the grub installation and deselect sda

Code: Select all

  exit
  for i in /dev/pts /dev /proc /sys; do sudo umount /mnt$i; done
13) Reboot and set the bios to boot one of the 2TB drives first. Boot into your RAID-0 Mint.
14) Check you are booted to the correct OS

Code: Select all

  mount
and check that the first line says /dev/md0 at /

Code: Select all

  swapon -s
and check that both swap partitions are listed
15) Reformat the 1TB drive or whatever you want to do with it.

That should be it.
Schoza

Re: setting up raid0 on linux mint 13

Post by Schoza »

hi
well i got to No 10. mounted the raid array
when i coping mint to it it filled the hard drive up completely got a low disc error(took hours copying it)
not sure what happened
it looked like the raid mounted ok though
appreciate any assistance
mintybits

Re: setting up raid0 on linux mint 13

Post by mintybits »

Schoza wrote:hi
well i got to No 10. mounted the raid array
when i coping mint to it it filled the hard drive up completely got a low disc error(took hours copying it)
not sure what happened
it looked like the raid mounted ok though
appreciate any assistance
Oops. Would you mind posting 'df -h', 'sudo blkid' and 'cat /proc/mdstat' ?

It is critical that you use the 'x' switch for rsync or it will recursively copy /mnt to /mnt/ to /mnt/mnt/ to /mnt/mnt/mnt/ etc. That would do a good job of filling up your array. It could be something else, tho.
Schoza

Re: setting up raid0 on linux mint 13

Post by Schoza »

hey minty
not sure what that means
Would you mind posting 'df -h', 'sudo blkid' and 'cat /proc/mdstat' ?
can u please explain
mintybits

Re: setting up raid0 on linux mint 13

Post by mintybits »

Yes. You might try deleting /mnt/mnt and retry the rsync command:
sudo rm -r /mnt/mnt
sudo rsync -vax / /mnt/

The options used for a terminal command are called switches. For a command like "rsync -vax /sourcePath/ /destinationPath/" the options, or switches, are v, a and x. The command could have been typed as "rsync -v -a -x ..." too. The v means verbose mode, the a means archive mode and the x means to copy only from the file system specified.

Your raid array, /dev/md0, has a separate file system from / and is mounted at /mnt. Mounting is a means to merge two filesystems so they behave as one. When rsync attempts to make everything under /mnt/ the same as in / it will normally get itself trapped in a loop because it will try to duplicate everthing in /mnt/ to /mnt/mnt/ and so on. The x switch prevents this because it tells rsync not to copy the /dev/md0 file system. So it wont try to copy /mnt/ to itself.


If you used -vax the first time then something else is wrong. Check that /dev/mount is mounted at /mnt using the command "mount" before running rsync.
mintybits

Re: setting up raid0 on linux mint 13

Post by mintybits »

Schoza wrote:Would you mind posting 'df -h', 'sudo blkid' and 'cat /proc/mdstat' ?
can u please explain
I mean, open a terminal and type
df -h
and post the output here so I can see it.
Also please post the ouputs of
mount
sudo blkid
cat /proc/mdstat
Schoza

Re: setting up raid0 on linux mint 13

Post by Schoza »

hey minty
i tried again and got to 11 copied ok i didnt use
sudo rm -r /mnt/mnt
i must have made a mistake first time round
opened fstab

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sde2 during installation
UUID=822b1635-357f-42b7-b2c7-e0522ef3904f / ext4 errors=remount-ro 0 1
# swap was on /dev/sde1 during installation
UUID=9b6a4b27-5506-419b-81e5-1672a788dfd1 none swap sw 0 0
not sure what i need to change
plus once i change it do i need to save it
also my raid is sda & sdc
mintybits

Re: setting up raid0 on linux mint 13

Post by mintybits »

The fstab file tells the OS where to find and how to mount file systems. Each uncommented line specifies a file system.
A file system entry consists of a partition identifier (usually a device name like /dev/sda1 or an identification number called a UUID), where in the root file system it is to be mounted and the type and options and how often automatic integrity checks should be run.

You need to change the 32 digit numbers after UUID=
These numbers uniquely identify file systems. You need to change them to match the new raid and swap whose UUIDs can be see using the command 'sudo blkid'
The first UUID for / needsvto match the blkid one for /dev/md0
The second UUID for swap needs to match the blkid one for /dev/sdb1

You should also add a second swap entry (copy and paste the last line) and change the UUID to match the blkid one for /dev/sdc1


After you have made thevchanges please post fstab again and also the output of 'sudo blkid'.
Schoza

Re: setting up raid0 on linux mint 13

Post by Schoza »

hey minty
when i tried to change the number in fstab when i typed the number nothing appeared on the screen am i supposed to text edit that file.
you mentioned chroot do i need to change the root
this is doing my head in lol, but slowly i am getting there with ur help, cheers
also i was going to post blkid but i rebooted and md0 was no longer there
i must say, although this has been painful (and it is probably painful for you as well) i will never forget how to raid lol
also when i do change it do i need to delete
errors=remount-ro 0 1
# / was on /dev/sde2 during installation
the during installation bit or just leave them
mintybits

Re: setting up raid0 on linux mint 13

Post by mintybits »

Hey. Well setting up a bootable RAID-0 is not really a beginners task to say the least. You will struggle with this. So either wait until you have learned more or expect it to take a while and go horribly wrong once or twice along the way. :)

You would be better using an easy text editor to edit fstab. It requires root privileges. Try,

gksudo gedit /mnt/etc/fstab

"chroot" is a special method for simulating being logged in to the new OS. So you get a new prompt and commands you issue are run as if by the new OS.
Before you do the chroot command you have to mount some special directories. This is what this line does:

for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done

And then you can run chroot:

sudo chroot /mnt

Now you have a root prompt in the new OS. So you can run some commands that set it up for RAID booting. Specifically,

update-initramfs -u
dpkg-reconfigure grub-pc


The last one reconfigures Grub and where it is installed. You choose using the arrow keys and space bar. You want grub in the two RAID disks. I don't know what your disks are called. Probably sda and sdb, or sdb and sdc. Do not install grub to a name ending with a number.

Then you can exit the chroot:

exit

and undo the special mounts

for i in /dev/pts /dev /proc /sys; do sudo umount /mnt$i; done

And you are back to where you started.
Now you can try booting the RAID-0.
Schoza

Re: setting up raid0 on linux mint 13

Post by Schoza »

hey minty
ok got it working
but when i copied os to raid
i got an error saying not all files copied
is there a way i can check if file system is in tact
also i am going to write a tutorial using ur instruction step by step giving you the credit of course, for newbs like myself
can i email it to you before i post it to proof it for me
last thing what is the best way to format the raid array to begin again, so i can write the tutorial step by step as i set up
mintybits

Re: setting up raid0 on linux mint 13

Post by mintybits »

Schoza wrote:hey minty
ok got it working
Great job! This is a tricky thing to set up. :D
but when i copied os to raid
i got an error saying not all files copied
is there a way i can check if file system is in tact
It is probably fine. I forgot, there is one file that doesn't copy called .gvfs but that isn't a problem. So if you saw this then you can ignore it. If you saw any other errors that's different.

Code: Select all

sending incremental file list
rsync: link_stat "/home/user/.gvfs" failed: Permission denied (13)

sent 63051 bytes  received 841 bytes  42594.67 bytes/sec
total size is 832777782  speedup is 13034.15
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1070) [sender=3.0.9]
also i am going to write a tutorial using ur instruction step by step giving you the credit of course, for newbs like myself
can i email it to you before i post it to proof it for me
Excellent idea. I will gladly proof read it for you. :) Best to send me a private message.
last thing what is the best way to format the raid array to begin again, so i can write the tutorial step by step as i set up
You mean erase the drives completely? You'll need to boot a different linux and then open Disk Utility and select each drive in turn and click "Format Drive". Make sure you choose the correct two drives. :wink:


Before you erase the RAID-0, would you mind posting the outputs of these terminal commands so I can check it is set up ok?

sudo blkid
cat /proc/mdstat
sudo mdadm -Es
cat /etc/mdadm/mdadm.conf
df -h
mount
Schoza

Re: setting up raid0 on linux mint 13

Post by Schoza »

hey minty

schoza@Fifi ~ $ sudo blkid
[sudo] password for schoza:
/dev/sda1: UUID="4daa1f91-b573-4a23-a7b2-b5fb4cb2f4fd" TYPE="swap"
/dev/sda2: UUID="8d771139-0f48-ea6c-6090-a8418cf01796" UUID_SUB="81aff144-78ef-35b5-ae5c-e6e35a632daf" LABEL="Fifi:0" TYPE="linux_raid_member"
/dev/sdb1: UUID="781c170b-aa90-46af-a243-d0486e248896" TYPE="swap"
/dev/sdb2: UUID="8d771139-0f48-ea6c-6090-a8418cf01796" UUID_SUB="cfd3d2cb-997f-2c40-7771-8e6dc7411e28" LABEL="Fifi:0" TYPE="linux_raid_member"
/dev/sdc1: UUID="2fbc5401-3a52-4da0-8d24-c341589c617d" TYPE="ext4"
/dev/sdc5: UUID="46be2765-0a61-434f-a4b8-e276f5fb5591" TYPE="swap"
/dev/md0: UUID="723fed13-080f-46d1-8275-8cfe9dfc19cf" TYPE="ext4"

schoza@Fifi ~ $ cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid0 sdb2[0] sda2[1]
3902928896 blocks super 1.2 512k chunks

unused devices: <none>

schoza@Fifi ~ $ sudo mdadm -Es
ARRAY /dev/md/0 metadata=1.2 UUID=8d771139:0f48ea6c:6090a841:8cf01796 name=Fifi:0

schoza@Fifi ~ $ cat /etc/mdadm/mdadm.conf
# mdadm.conf
#
# Please refer to mdadm.conf(5) for information about this file.
#

# by default (built-in), scan all partitions (/proc/partitions) and all
# containers for MD superblocks. alternatively, specify devices to scan, using
# wildcards if desired.
#DEVICE partitions containers

# auto-create devices with Debian standard permissions
CREATE owner=root group=disk mode=0660 auto=yes

# automatically tag new arrays as belonging to the local system
HOMEHOST <system>

# instruct the monitoring daemon where to send mail alerts
MAILADDR root

# definitions of existing MD arrays

# This file was auto-generated on Fri, 01 Jun 2012 19:39:23 +1000
# by mkconf $Id$
ARRAY /dev/md0 metadata=1.2 name=Fifi:0 UUID=8d771139:0f48ea6c:6090a841:8cf01796

schoza@Fifi ~ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/md0 3.7T 59G 3.4T 2% /
udev 3.9G 8.0K 3.9G 1% /dev
tmpfs 1.6G 1.1M 1.6G 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 3.9G 76K 3.9G 1% /run/shm

schoza@Fifi ~ $ mount
/dev/md0 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/schoza/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=schoza)
mintybits

Re: setting up raid0 on linux mint 13

Post by mintybits »

That looks good. You should also check that both swap partitions are in use:

swapon -s

If not, let's see what's in fstab.
Schoza

Re: setting up raid0 on linux mint 13

Post by Schoza »

in gparted both drives are mounted
and in disk utillity raid is running but when i check array i get error Daemon is inhibited
ive taken out the other drive and it seems to run ok and boot ok as well
Last edited by Schoza on Sat Jun 02, 2012 2:15 am, edited 1 time in total.
Schoza

Re: setting up raid0 on linux mint 13

Post by Schoza »

ok found it /etc
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/md0 during installation
UUID=723fed13-080f-46d1-8275-8cfe9dfc19cf / ext4 errors=remount-ro 0 1
# swap was on /dev/sdb1 during installation
UUID=781c170b-aa90-46af-a243-d0486e248896 none swap sw 0 0
# swap was on /dev/sdc1 during installation
UUID=4daa1f91-b573-4a23-a7b2-b5fb4cb2f4fd none swap sw 0 0

do i need to change the swap to sda & sdb
mintybits

Re: setting up raid0 on linux mint 13

Post by mintybits »

That all looks good. :)
Locked

Return to “Beginner Questions”