RAID5 on raspberry with USB drives

    • OMV 2.x

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • RAID5 on raspberry with USB drives

      Hello,

      I'm running OMV 2.0.15 on a raspberry pi with 3 harddisks in 4-bay sata harddisk-to-usb box. (probox with sata usb hub only)
      The harddisks are visible as /dev/sda - c

      The issue is now that obviously at system start up the raspberry (1GB version) is faster than the harddisks are starting up and getting visible as devices, so md0 will not get started at boot time.
      As this fails I'm doing a mdadm --assemble md0 to get the raid up and running (only after all 3 devices are visible). Now because of that startup of md0 failed at boot time, the array will not be created as md0, but md127 on top of everything...

      So my questions are:
      - What is the official way for the raspberry image of omv to get usb drives started within a raid? Producing an image for raspberry a connection of an USB storage device was probably not so unexpected.
      - Do I really need to run a bash-script after start checking if all devices are visible and the reassmble the raid or is there any other consideration of that part of OMV already?

      What I specifically don't like about that, is that configuration is partly in the web-gui, partly in bash script to get the raid configuration alive again, after system reboot...

      Any thoughts about this?

      thanks,
      best regards
      Tjareson
    • While expected, there is no "official" way to get the image to work with a usb array. I don't have three usb hard drives to test with. Three flash drives worked fine if I remember correctly. USB hard drives also have different startup times across manufacturers. So, from what I can tell, you will either have to use a startup script or stop using mdadm raid. You could use a unionfilesystem or snapraid or something else. This isn't an OMV issue. Not sure what else to tell you.
      omv 4.0.5 arrakis | 64 bit | 4.12 backports kernel | omvextrasorg 4.0.2
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please don't PM for support... Too many PMs!
    • I've implemented a script in /etc/rc.local now, which is waiting until all 4 usb drives are up and then assemble the Raid 5 and mount everything (there is one remaining disk, not part of RAID5 in my case, which also wouldn't get mounted by OMV, as not available when fstab gets applied)

      It is not so much about if it is an "OMV-issue", it is just trying to find a solution solely based on OMV without extra hacks. Making use of old harddisks with a cheap raspberry pi is in my opinion a very feasible setup. So it would be nice if OMV somehow could handle it without extra scripts, which needs to be adjusted, whenever certain changes are done in the web-gui of OMV. Not sure what I could possibly contribute to support this?

      Anyway, here is the script part for /etc/rc.local for the time being, just in case anyone else is facing similar problems. It is based on the script I found here: webdiary.com/2011/02/06/wait-for-usb/ I've adjusted it for four drives and changed syntax for sh instead of bash.

      Source Code

      1. ​usbdrive1="/dev/sda"
      2. usbdrive2="/dev/sdb"
      3. usbdrive3="/dev/sdc"
      4. usbdrive4="/dev/sdd"
      5. # Max time to wait (in seconds)
      6. maxwait=180
      7. case "$1" in
      8. start)
      9. echo "Waiting for USB disk drive $usbdrive"
      10. for i in $(seq 0 $maxwait)
      11. do
      12. [ -b $usbdrive1 ] && [ -b $usbdrive2 ] && [ -b $usbdrive3 ] && [ -b $usbdrive4 ] && exit 0
      13. echo -n "."
      14. sleep 1
      15. done
      16. exit 1
      17. ;;
      18. stop)
      19. ;;
      20. esac
      21. sleep 3
      22. /sbin/mdadm --assemble /dev/md0
      23. sleep 3
      24. /bin/mount -a
      Display All


      It needs to be inserted into /etc/rc.local before the exit 0 statement, which is usually at the end.

      best regards
      Tjareson
    • Glad you have a something that works. This is tough to fix at the OMV level because it isn't common. While there are plenty of people using an RPi as a NAS, most aren't using mdadm raid. They are either letting the usb enclosure do the raid work or just have disks connected.

      I suppose a plugin could be created that enables/disables a script that loops through all drives found in mdadm arrays and then assembles/mounts them (just like your script). Unfortunately I don't have much time.
      omv 4.0.5 arrakis | 64 bit | 4.12 backports kernel | omvextrasorg 4.0.2
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please don't PM for support... Too many PMs!