How to recover RAID 1 Mirror after a single drive failure or removal and get access to your data straight away

  • OK - so this isn't so much a question but something I hope will help people...


    This shows you how to recover and re-access data on a failed RAID1 array (two drives mirrored) if OpenMediaVault is no longer seeing your RAID array.


    I see a lot of negative talk about RAID1 (mirroring on here) and the way OpenMediaVault handles RAID1 when a disk fails or is removed. I still can't understand why OpenMediaVault doesn't do the following automatically but hey hum I expect there will be someone with a good explanation...


    Problem is if a disk fails while the box is off (a power spike or cut will do this) you might find yourself in a position where OpenMediaVault can no longer see your RAID array. Obviously you have a good backup somewhere so there is no worries if you actually do lose data but that takes time to restore etc and sometimes you want your NAS box back and functioning ASAP and don't want to wait for a new disk from Amazon to arrive before you can rebuild and get back to normal.


    WARNING: I am NOT responsible for your data or any loss of it!


    So very quickly before I start - why would I want to use RAID instead of RSYNC or similar??? Well basically I switch my NAS box on and off via WOL and SSH all the time. I have an app on my phone which allows me to wake it up when I want and turn it off when I want. Call me a hippy, call it saving the planet call it the fact I simply don't like a box buzzing away in the corner the whole time. Either way I prefer to rely on RAID for redundancy than RSync and a schedule... That's my choice and I'm happy if you think that's crazy.


    So to get your share back you basically have to do two things. First, force a restart of the array with the single good disk. Second remount it so you can access it via a share, and here's how...



    1. SSH or connect via the console log onto your openmediavault using root and the password you set at setup


    2. First we need to make sure that the raid array is still there. Run "cat /proc/mdstat" and you should see something like this in the data returned...


    md0 : inactive sdc[2](S)


    Make a note of the "mdx" bit where x could be any number and the "sdx" bit where x could also be any number. The md0 is your mdadm (RAID) array and the sdc is the disk that's still working/present.


    3. Now we need to take the array offline so we can restart it with just one disk


    mdadm --stop /dev/md0


    4. Now force the array back online and active using the following command...


    mdadm --assemble --force --verbose /dev/md0 /dev/sdc


    make sure you change the md0 and sdc bits appropriately. You should get a message that reads


    mdadm: /dev/md0 has been started with 1 drive (out of 2).


    AND it should now show up as degraded in OpenMediaVault under raid but you still won't be able to access it yet...


    5. Now your array is back online you need to remount it so that you can access it via a share. Check the share tab in openmediavault for the share or shares that are on the raid array. You will see the name of the share and the device. Make a note of that device.


    mine looked like this...


    /srv/dev-disk-by-label-RaidDisk


    You can also run


    cat /etc/fstab


    from the console and you should see the persistent mount point listed there too -- compare notes if you like...


    6. Now you need to mount that array using the mount point used by the share... From the console run...


    mount /dev/md0 /srv/dev-disk-by-label-RaidDisk (again make sure you adjust for your config)


    7. Voila - you should now be able to access your share...

    • Offizieller Beitrag

    I still can't understand why OpenMediaVault doesn't do the following automatically but hey hum I expect there will be someone with a good explanation...

    When an array fails to assemble, it shouldn't automatically start degraded because it needs to be fixed. Some people would never notice it was degraded and defeat the purpose of raid.

    Now you need to mount that array using the mount point used by the share.

    mount -a would work too.

    why would I want to use RAID instead of RSYNC or similar??? Well basically I switch my NAS box on and off via WOL and SSH all the time. I have an app on my phone which allows me to wake it up when I want and turn it off when I want. Call me a hippy, call it saving the planet call it the fact I simply don't like a box buzzing away in the corner the whole time. Either way I prefer to rely on RAID for redundancy than RSync and a schedule... That's my choice and I'm happy if you think that's crazy.

    Not going to tell you what to do but using raid with a system that gets shutdown a lot is asking for problems. And running rsync every minute or few minutes would be damn close to raid 1.

    omv 7.0.5-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.13 | compose 7.1.4 | k8s 7.1.0-3 | cputemp 7.0.1 | mergerfs 7.0.4


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Some fair points there I feel. It makes for an interesting discussion anyway...


    I'll concede and say starting a degraded raid array automatically might be a bad idea. You'd hope the user would have set up notifications and check occasionally but I do get your point. It would be nice if there was an option to bring it back on line via the web interface rather than mucking about under the hood though.


    Secondly OK OK - I'm really going to have to look into RSync. I'll have a play. Maybe you're right but if the box is shut down cleanly the RAID array should be taken offline cleanly and there shouldn't be any problems. I've been doing it for literally years with a windows box but just fancied a change. Is there some inherent unreliability in MDADM that I don't understand.


    Also - thank you for responding and adding these comments. I might even concede you're right after I've had a closer look at RSync.


    Thank you

    • Offizieller Beitrag

    Maybe you're right but if the box is shut down cleanly the RAID array should be taken offline cleanly and there shouldn't be any problems. I've been doing it for literally years with a windows box but just fancied a change. Is there some inherent unreliability in MDADM that I don't understand.

    "Shouldn't" is the key word. Raid was never designed to be started up and shutdown on a frequent basis. Syncing the array on every startup is a good amount of wear and tear on the drives. All it takes is for the bios to spin up a drive a little late or the disk itself to spin up late and your array won't assemble. I would probably blame the bios more than mdadm. I have used mdadm for 15+ years and never had an issue but I have always used it on servers with battery backup and run 24/7.

    omv 7.0.5-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.13 | compose 7.1.4 | k8s 7.1.0-3 | cputemp 7.0.1 | mergerfs 7.0.4


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!