Change from raid5 to raid1

  • Hello,


    I had my root-filesystem as raid5. Now I want to switch to raid1.

    I have (had to) remove one drive already:


    Is it now possible to change from this degraded raid5 to a raid1?

    I tried this:

    Code
    mdadm --grow -l 1 -n 2 /dev/md0
    mdadm: Can only convert a 2-device array to RAID1
    root@homeserver:/home/henfri# mdadm --grow  -n 2 /dev/md0
    mdadm: this change will reduce the size of the array.
           use --grow --array-size first to truncate array.
           e.g. mdadm --grow /dev/md0 --array-size 31457216

    But when I execute the suggested step, the system gives me an ext4 error.


    Regards,

    Hendrik

    • Offizieller Beitrag

    You ran your OS on raid 5?? Degraded raid 5 array is still twice the size as a raid 1. So, you need to shrink the filesystem before you can do that. You can't do that while the root filesystem is mounted read write.

    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!

  • Hello,


    yes, that is what popped into my mind when lying in bed yesterday... Sorry.

    So, I boot to systemrescuecd, then do a fsck, then a resize2fs.

    Then, I do a mdadm --grow /dev/md0 --array-size 31457216 to shrink the array.

    Then, with mdadm --grow -n 2 /dev/md0 I can reduce to two devices.

    Finally, with mdadm --grow -l 1 /dev/md0 I can change to raid1


    Correct?


    Alternatively... I have a backup (fsarchiver).

    I could wipe the array create a new one and restore into that.


    What would you recommend?

    The second option lets me (for the first time) check my recovery strategy... So I sympatize with it.


    Regards,

    Hendrik

    • Offizieller Beitrag

    Correct?

    Seems like it would work but I haven't shrunk many mdadm arrays (probably none).


    Alternatively... I have a backup (fsarchiver).

    I could wipe the array create a new one and restore into that.


    What would you recommend?

    I would shrink the filesystem size and clone it with clonezilla. Then create a new array. Then you have a backup in case anything goes wrong.

    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!