-1

currently status:

4 disk part 200G each, total 800G using raid0

raid0, md0: sda1+sdb1+sdc1+sdd1

and I want to add another disk part sdf1(>800G)

combine with md0 to make a raid10, like

raid1, md1: md0+sdf1

so I can replace the 4disks sd[a-d] later.

but when I tried with a VM,

the filesystem was destroyed afer doing with the following command.

mdadm --create --verbose /dev/md1 --level=1 --raid-devices=2 /dev/md0 /dev/sdf1

what should I do?

thanks.

  • Which filesytem was destroyed? I'd just backup the data, build the new RAID1 and restore the backup on it. You are not trying to create RAID10, but some half-form of RAID01 – Lenniey Sep 24 '19 at 15:45
  • Read the manual to understand what commandline tools and their options do. For starters [`man mdadm`](https://linux.die.net/man/8/mdadm) explains that **`--create`** is used *Create a **new** array* and you instead would need (possibly among others options and flags) **`-G, --grow`** to *"**Change** the size or shape of an **active array".*** – HBruijn Sep 24 '19 at 15:45

2 Answers2

0

what should I do?

Ideally: Restore your data from backup!...

If you don't have so one

  1. Stop everything

    mdadm --stop /dev/md1

  2. Retrieve loosed datas

    If your /dev/md0 was LVM, you have to use gpart. If it was ext4 you may restore them by using fsck, with superblock backup. See man fsck.ext4

  3. Re-Create md1, but as degraded Raid1:

    mdadm --create --verbose /dev/md1 --level=1 --raid-devices=2 missing /dev/sdf1

  4. Copy datas

    copy your data, from md0 to md1

  5. Final step

    Unmount md0, move your need (grub, initramfs...)

    Then add md0 to md1

    mdadm -a /dev/md1 /dev/md0
    
    • Nota you may have to wipe datas on md0 before...

      dd if=/dev/zero of=/dev/md0 count=2048
      
0

@ HBruijn thanks, I'm misunderstanding the command,

and @ Lenniey is right,

this does not upgrade a raid0 to raid10 or raid01,

my filesystem is a private struct, so I need a block-level copy.

but I find a way to get what I want.

0) boot into live-cd

1) create a single raid1 md1 with sdf1

2) dd if=/dev/md0 of=/dev/md1

3) stop md0 and md1

4) assemble md1 with sdf1 and update UUID name as same as md0

5) remove sd[a-d]

6) reboot into system

confirmed with VM, and will be performed on online system tomorrow.