[HOW-TO] Convert OMV install to system RAID-1 install

  • ok I think this is the right place for this as it is related to install process not data storage.


    I just want to help any new user who want to run OMV on a raid-1 system disk.
    I have found several very good help blogs describing the process of converting system to raided setup


    blog #1 by Josip Lazić http://lazic.info/josip/post/i…ediavault-on-raid-device/
    blog #2 by François Marier https://feeding.cloud.geek.nz/…ting-up-raid-on-existing/
    I have found however that some steps do not work all the time or not as I was expecting them to, so with some trial and error here are exact steps that did worked perfectly for me.


    !A WORD OF CAUTION !
    please check each and every command for proper disk references.
    I had to reinstall twice simply because I used wrong disk as target.



    Assumptions taken


    #0 we are using OMV version 2.+ (my actual version was 2.2.4)


    #1 the initial setup is done as normal on /dev/sda
    if you are installing a-new plugin only 2 drives you want to use as system drive when all is done.
    in my case I used 2 120GB SSD
    an Intel SSD 535 Series and a SanDisk SDSSDA12 series


    I run install on /dev/sda (intel)
    and used SanDisk to create mdadm raid for conversion.


    SO


    Step 1. install both disks in the machine. make sure they are the only drives installed and run OMV setup.
    a. if you can use CD for installation. I had to scrap several setups do to "can not install grab" error when using USB stick.
    yes even though I was installing on SSD it still tried to install grab on usb stick I was installing from and destroyed the stick.
    b. choose to install to /dev/sda when warned about multiple drives found on the system. for some reason OMV prefers /sda over anything else so just use the KISS
    c. boot the machine and configure with webui. change admin password what ever.
    make sure everything is running as expected, configure network etc.
    d. start ssh server.


    Step 2. once all is working open terminal and ssh into machine
    we can skip the installation of the tools as instructed in the blogs above since OMV already have all of that installed


    A. Partition the empty drive (/dev/sdb). by default OMV install creates 3 partitions 1. boot(MBR) 2. / and 3 . swap
    we will replicate the same.


    from blog 1 : and I am using numbers for my config to set partition size

    Code
    parted -a optimal /dev/sdb mklabel gpt
    parted -a optimal /dev/sdb mkpart grub ext2 2048s 12M = 10M !! this is our boot partition !!
    parted -a optimal /dev/sdb mkpart root ext4 12M 111GB = 103GB !! will be used for md0 "/" !!
    parted -a optimal /dev/sdb mkpart data ext4 111GB 100% = 8.4GB!! md1 "swap" !!
    parted -a optimal /dev/sdb set 1 bios_grub on
    parted -a optimal /dev/sdb set 2 boot on


    this is the only thing I used from blog 1


    the rest is from blog 2


    B. Create new degraded mdadm array
    NOTE: we need to change the lines below to point to /dev/sdb2 and /dev/sdb3 not 1 and 2 as /dev/sdb1 is our boot partition

    Code
    mdadm --create /dev/md0 --level=1 --raid-devices=2 missing /dev/sdb2
    mdadm --create /dev/md1 --level=1 --raid-devices=2 missing /dev/sdb3


    C. format new raid devices


    Code
    mkswap /dev/md1
    mkfs.ext4 /dev/md0



    adjust /etc/mdadm/mdadm.conf by adding "DEVICE /dev/sda* /dev/sdb*

    Code
    mdadm --detail --scan >> /etc/mdadm/mdadm.conf
    dpkg-reconfigure mdadm


    run GRUB config and choose both drives a and b to install grub to. Make sure you choose the /dev/sda and /dev/sdb nothing else

    Code
    dpkg-reconfigure grub-pc


    D. mount the new raid volume and copy existing drive to it


    Code
    mkdir /tmp/mntroot
    mount /dev/md0 /tmp/mntroot
    rsync -auHxv --exclude=/proc/* --exclude=/sys/* --exclude=/tmp/* /* /tmp/mntroot/


    E. run a blkid and get the uuid for md0 and md1
    edit fstab in "/tmp/mntroot/etc/fstab" and change uuid for "/" and "swap" to the respected uuid for md0 and md1



    Then reboot and from within the GRUB menu, hit "e" to enter edit mode and make sure that you will be booting off of the new disk:


    set root='(md/0)'
    linux /boot/vmlinuz-2.6.32-5-amd64 root=/dev/md0 ro quiet


    and yes you can actually use the values seen here. the omv grab use hd0,mbr notation for root in set root, and uuid for root in second line just use /dev/md0


    Once the system is up, you can check that the root partition is indeed using the RAID array by running mount and looking for something like:


    "/dev/md0 on / type ext4 (rw,noatime,errors=remount-ro)"


    now if all looks good use the same code we use on top to partition the sda drive, this will essentially wipe-out the drive and create exactly the same partiton table we hav on sdb drive


    Code
    parted -a optimal /dev/sda mklabel gpt
    parted -a optimal /dev/sda mkpart grub ext2 2048s 12M = 10M !! this is our boot partition !!
    parted -a optimal /dev/sda mkpart root ext4 12M 111GB = 103GB !! will be used for md0 "/" !!
    parted -a optimal /dev/sda mkpart data ext4 111GB 100% = 8.4GB!! md1 "swap" !!
    parted -a optimal /dev/sda set 1 bios_grub on
    parted -a optimal /dev/sda set 2 boot on


    add new partiton to raid array and wait until it finish synchronizing


    mdadm /dev/md0 -a /dev/sda2
    mdadm /dev/md1 -a /dev/sda3



    perform the test described by François Marier in the second blog to ensure all is as expected.
    and we are done. we can not continue setting up the system as we like


    good luck

    omv 3.0.56 erasmus | 64 bit | 4.7 backport kernel
    SM-SC846(24 bay)| H8DME-2 |2x AMD Opteron Hex Core 2431 @ 2.4Ghz |49GB RAM
    PSU: Silencer 760 Watt ATX Power Supply
    IPMI |3xSAT2-MV8 PCI-X |4 NIC : 2x Realteck + 1 Intel Pro Dual port PCI-e card
    OS on 2×120 SSD in RAID-1 |
    DATA: 3x3T| 4x2T | 2x1T

  • also found on this forum
    do the same thing using raider utility http://forums.openmediavault.o…od-to-have-it/#post113728

    omv 3.0.56 erasmus | 64 bit | 4.7 backport kernel
    SM-SC846(24 bay)| H8DME-2 |2x AMD Opteron Hex Core 2431 @ 2.4Ghz |49GB RAM
    PSU: Silencer 760 Watt ATX Power Supply
    IPMI |3xSAT2-MV8 PCI-X |4 NIC : 2x Realteck + 1 Intel Pro Dual port PCI-e card
    OS on 2×120 SSD in RAID-1 |
    DATA: 3x3T| 4x2T | 2x1T

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!