Announcement

Collapse
No announcement yet.

Software raid1, but not as boot

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Software raid1, but not as boot

    I am about to install Kubuntu on a spare PC to test if it will be ok as a server at home.

    Before I start, I would like to know a little about the software raid feature. I am on a very slow internet line and I have the standard install of Kubuntu 8.04. Downloading the alternative image would take me another couple of days....

    I do NOT want to boot Kubuntu off a raid set. It is going to be on a normal single disk. What I am looking for is a simple way to set up mirroring (raid 1) and mount as /home to store all user generated data. I have two identical 120GB IDE disks to use for this. Kan this be done in the Kubuntu diskmanager after installation?

    EDIT: I am also going to use the whole disk as one partition. No need to split it. Trying to keep things as simple as possible. :-)
    Regards,
    Oceanwatcher
    Blog: http://www.wisnaes.com/
    Pictures: http://www.oceanwatcher.com/
    Software tips (in Norwegian): http://www.datahverdag.com/

    #2
    Re: Software raid1, but not as boot

    Hi There,

    Ok, so I am also fairly new to Kubuntu but after reading the forums and googling alot I got the following procedure together... it isn't as simple as Windows, but is more flexible...

    I have copied and pasted instructions from my guide (which at some point I will post somewhere officially), it is based on 7.10 (I am using LinuxMCE which requires Kubuntu Gutsy Gibbon 7.10). The procedure isnt exactly what you want as it is raid 5 rather than what you want (RAID1), but you should be able to modify it easily, I don't have time right now, but if you get stuck. send a reply.

    -------------------

    Creatg RAID on Gutsy - based on http://www.linuxforums.org/forum/deb...ing-mdadm.html

    cheap onboard RAID does is not advised for use with LINUX; it isn't really hardware RAID, just a layer of software that is proprietary and requires proprietary drivers... it doesn't give you much and creates a lot of headsches apparently so unless you want to share the partition with a Windows OS (Dual boot on same PC), dont do it... just use Linux software raid. Windows XP/Vista is limited as the RAID has to be setup in the RAID BIOS, limiting you to devices attached to the single controller or specific ports, Linux Software RAID however allows you to span multiple controllers or non-specific RAID ports on your motherboard.

    this process is only for addng new drives, or adding drives that you are not using for your system partitions

    add the drives to your system
    determine their "names" such as /dev/sda this can be found in system settings -> advanced -> disks and filesystems

    install package mdadm, you may have to go into adept and turn on non-free, universe and multiverse repositories.

    open konsole

    *

    use cfdisk to prepare teh drives, this is a command line tool

    for example for each drive use teh command
    sudo cfdisk /dev/sda
    where /dev/sda is the name of one of your drives

    a screen will appear with a listing of any partitions on the specified drive.

    You need to create partitions on each of the disks that are exactly the same size

    delete any partitions that prevent this... remember this will delete the data in those partitions... so do this with care

    then create a new partition, a primary partition... on the final screen of this part select a size that is the size of your largest available area on any of your selected disks.

    goto type, a listing of available types will be displaye, press any key to see a second list and be offered an option to enter the s=partition type, enter FD = 'Linux RAID Auto Detect'

    select write
    select quit
    repeat from * for each of your hard discs selected to go into your raid

    decide what your new array is going to be referred as, md0 is a good choice

    ensure that if there is previous array on md0 it is stopped
    sudo mdadm --stop /dev/md0

    for a 4 drive RAID5 array, with no spare enter
    sudo mdadm --create --force /dev/md0 --chunk=64 --level=5 --raid-devices=4 --spare-devices=0 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1


    it seems that mdadm tries to enforce a spare drive rather than use all the drives as a big array. this is why the --force option is used, to make mdadm use this arrangement.

    where the list of drives at the end of the list is the list of drives that you have previously partitioned ready for use.#
    MDADM will now syncronise the drives ensuring the same data on all the drives; this takes a while

    After the sync; to determine progress use
    sudo mdadm --detail /dev/md0

    the output looks something like

    /dev/md0:
    Version : 00.90.03
    Creation Time : Sun Aug 10 23:31:14 2008
    Raid Level : raid5
    Array Size : 1465151808 (1397.28 GiB 1500.32 GB)
    Used Dev Size : 488383936 (465.76 GiB 500.11 GB)
    Raid Devices : 4
    Total Devices : 4
    Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Sun Aug 10 23:41:23 2008
    State : active, resyncing
    Active Devices : 4
    Working Devices : 4
    Failed Devices : 0
    Spare Devices : 0

    Layout : left-symmetric
    Chunk Size : 64K

    Rebuild Status : 26% complete

    UUID : 6cda217b:8285d2a1:36fbafe5:64690a52 (local to host LinuxMCE)
    Events : 0.3

    Number Major Minor RaidDevice State
    0 8 17 0 active sync /dev/sdb1
    1 8 33 1 active sync /dev/sdc1
    2 8 49 2 active sync /dev/sdd1
    3 8 65 3 active sync /dev/sde1





    notice the rebuild status of 26% in this case.


    (if you're impatient you can continue anyway but it is illadvised; if you really want to...
    sudo mdadm --run /dev/md0
    this starts a partially built array


    add a the RAID config to the config file by copying the output exactly into the bottom of this config file
    sudo kate /etc/mdadm/mdadm.conf

    this should then look like the following, note my config at the bottom

    # mdadm.conf
    #
    # Please refer to mdadm.conf(5) for information about this file.
    #

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

    # 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 Sun, 10 Aug 2008 21:31:18 +0100
    # by mkconf $Id: mkconf 324 2007-05-05 18:49:44Z madduck $

    ARRAY /dev/md0 level=raid5 num-devices=4 UUID=6cda217b:8285d2a1:36fbafe5:64690a52


    now to add a file system, run

    sudo mkfs.ext3 -b 4096 -R stride=16 /dev/md0

    now we need to make out mount point... i want to pu all my samba shared files in /store/

    a mount point is a directory where a partition can be "attached". When that is done, anything contained in the directory before the attachment is not available until it is detached. This is confusing to new users, like me!

    cd /
    sudo mkdir store

    now I want to attach the new RAID drive, to the mount point I just created

    sudo mount -t ext3 /dev/md0 /store

    now, for a giggle... seeing how much disk space you have in your new RAID (this even works if the drive hasn't finished building)

    enter simply 'df'

    Filesystem 1K-blocks Used Available Use% Mounted on
    /dev/sda1 36843208 7127996 27843644 21% /
    varrun 2027348 140 2027208 1% /var/run
    varlock 2027348 0 2027348 0% /var/lock
    udev 2027348 140 2027208 1% /dev
    devshm 2027348 0 2027348 0% /dev/shm
    lrm 2027348 38324 1989024 2% /lib/modules/2.6.22-14-generic/volatile
    /dev/md0 1442161020 202368 1368701064 1% /store


    it's indicated in kilobytes so my new RAID 5 partition mounted on /store has 1.3TB or 1300GB or 1,300,000MB free

    'df -h' makes it more readble


    df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/sda1 36G 6.8G 27G 21% /
    varrun 2.0G 140K 2.0G 1% /var/run
    varlock 2.0G 0 2.0G 0% /var/lock
    udev 2.0G 140K 2.0G 1% /dev
    devshm 2.0G 0 2.0G 0% /dev/shm
    lrm 2.0G 38M 1.9G 2% /lib/modules/2.6.22-14-generic/volatile
    /dev/md0 1.4T 198M 1.3T 1% /store



    finally, lets get this to startup and mount on system startup.

    I have seen from other tutorials that the RAID needs remounting on reboot and you must create startup scripts for it to complete this automatically. When I reboot at this point, and use konqueror to go back to /store/ then look at properties it still says 1.3TB spare/available space. Eventually this will be dropped, so complete the following to mount on boot,


    sudo kate /etc/fstab

    add to the bottom of the file the following line (replace md0 with the device name and /home with teh mount point)

    /dev/md0 /home ext3 errors=remount-ro 0 0

    save and exit.

    check your array in konqueror, reboot a few times to make sure it stays mounts (I have noticed I get a failure message to the mount on boot, but it it mounted... strange.





    Comment


      #3
      Re: Software raid1, but not as boot

      Wow! That was a mouthfull! And exactly why I would like to see this with a nice GUI or absolutely preferrably as a function in gparted.

      I can not understand why it should not be possible to ctrl-click on the different drives, choose what raid level you want to use and click ok... Should be as easy as that...

      Of course, we all love hardware raid and I will get my 3ware controller installed eventually. But there are a lot of people that can not afford it and still need a way to protect their data. So my suggestion is software raid 1.

      Thank you for putting this together! At least I can get it set up and tested.
      Regards,
      Oceanwatcher
      Blog: http://www.wisnaes.com/
      Pictures: http://www.oceanwatcher.com/
      Software tips (in Norwegian): http://www.datahverdag.com/

      Comment

      Working...
      X