Currently I am building a nextcloud server on Ubuntu 20.04. I got one disk for the OS to run on a 320GB harddisk. And I want the data directory to be in a raid1 array, because if one drive fails we still have the other drive with the data. So I got 2 harddisks of 500GB in a raid1 array on /dev/md0.

When I run: cat /proc/mdstat

Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]
md0 : active raid1 sdb[0] sdc[1]
      488254464 blocks super 1.2 [2/2] [UU]
      bitmap: 0/4 pages [0KB], 65536KB chunk

unused devices: <none>

it says its active, when i run: sudo mdadm --detail /dev/md0

           Version : 1.2
     Creation Time : Fri Aug 14 16:50:18 2020
        Raid Level : raid1
        Array Size : 488254464 (465.64 GiB 499.97 GB)
     Used Dev Size : 488254464 (465.64 GiB 499.97 GB)
      Raid Devices : 2
     Total Devices : 2
       Persistence : Superblock is persistent

     Intent Bitmap : Internal

       Update Time : Sat Aug 15 14:50:13 2020
             State : clean
    Active Devices : 2
   Working Devices : 2
    Failed Devices : 0
     Spare Devices : 0

Consistency Policy : bitmap

              Name : nextcloudserver:0  (local to host nextcloudserver)
              UUID : e525d3e8:2d738f44:59d495fa:2fdcce41
            Events : 9032

    Number   Major   Minor   RaidDevice State
       0       8       16        0      active sync   /dev/sdb
       1       8       32        1      active sync   /dev/sdc

it says thate state is clean. Shouldn't it be resyncing ?

Sudo mdadm --detail /dev/md0

mdadm: No md superblock detected on /dev/md0.

Did I miss something out?

So /dev/md0 is mounted on /mnt/raid1. I created a text file in /mnt/raid1. When I shut down the pc and plug out one hdd's in the raid1 array and boot the pc. I can't find the textfile that I made in /mnt/raid1.

And if I run cat /proc/mdstat it says status is inactive

So could anyone help me out whit mirroring the disks. So that if one fails nextcloud still has the date on the other disk.

Any help would be appreciated thanks in advance

This is the tutorial I followed: (https://www.linuxbabe.com/linux-server/linux-software-raid-1-setup)

Until step 5 it works for me. After plugin out one of the harddrives I can't follow along anymore.


You can force it I guess the command was:

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

however people create partitions and then create md0 array on them thus command would become ,

mdadm --assemble --force /dev/md0 /dev/sdb1 /dev/sdc1

(I did not understand but you may have created it on raw disks ...)

which will give you your files.

The point is disk shows inactive when you force it it will show degregaded. Normall once an array is inactive you should use mdadm --scan --detail to figure out what is going on. If a drive has failed you should use --fail to render it failed. And then using sgdisk copy gpt table of working disk to new disk and change new disks uuid and rebuild the array.

But you can always force single disk to create your array.

The big problem here would be using raid1 instead of proper daily backup. Raid is for uninterrupted operation and when a disk fails /proc/mdstat would show it and you can continue your operation even --fail the disk and resync it and it auto rebuilds without stopping the operation ...

Check this out:


  • this is the output root@nextcloudserver:/mnt/raid1# mdadm --assemble --force /dev/md127 /dev/sdb1 /dev/sdc1 mdadm: /dev/sdb1 is busy - skipping mdadm: /dev/sdc1 is busy - skipping – Mike milkshake Aug 16 '20 at 13:27
  • umount sdc1 , stop array ... or just assemble with one disk which is available ... – Gediz GÜRSU Aug 16 '20 at 14:34
  • just a curious question why do you think that it's not a good idea to, to use the raid1 array as a kind of backup. Because that will be the directory where data will be stored of users. And if tone drive fails we still have the data of the mirrored disk. If we then replace the failed harddisk it will just start mirroring again. So i dont see why this isn't a proper daily backup ? – Mike milkshake Aug 16 '20 at 15:14

Your output from cat /proc/mdstat shows a properly functioning RAID 1 array.

md0 : active raid1 sdb[0] sdc[1]
      488254464 blocks super 1.2 [2/2] [UU]
      bitmap: 0/4 pages [0KB], 65536KB chunk

Here, active means that it's up, with two disks. Anything you write to md0 will be mirrored to both disks.

In your mdadm --detail output, clean means that MD believes both disks to be in sync. Both /proc/mdstat and mdadm --detail it would have shown resync after you created the array, while it brought the two drives into synchronization, unless you used --assume-clean on the command line for mdadm create.

The subsequent problems, I believe, are all due to not having the RAID array start up boot time, and not having the filesystem you created mounted at boot time. For example, in your output below, the array is clearly not running.

sudo mdadm --detail /dev/md0
mdadm: No md superblock detected on /dev/md0.

If, after startup, your array isn't running, you can assemble it manually like this:

mdadm --assemble /dev/md0 /dev/sdb /dev/sdc

Then, mount your filesystem.

mount /dev/md0 /mnt/raid1

To have the array automatically started at boot, you need to configure in in /etc/mdadm.conf. The easiest way is just to send the output of mdadm --detail --scan there when the array is running.

mdadm --detail --scan >> /etc/mdadm.conf

To mount the filesystem at boot, add it to /etc/fstab. Follow the instructions in there, or make it look like one of the other entries.

As the other answerer said, RAID isn't a backup solution. RAID will keep you running when some of your hardware fails. But, it won't help you if all your hardware fails, or if your hardware or software corrupts the data. So, if the data is important, investigate backup techniques.

  • so i rebooted my pc and now if i run cat /proc/mdstat root@nextcloudserver:/mnt/raid1# cat /proc/mdstat Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] md127 : active (auto-read-only) raid1 sdc1[1] sdb1[0] 488253440 blocks super 1.2 [2/2] [UU] resync=PENDING bitmap: 4/4 pages [16KB], 65536KB chunk unused devices: <none> it changed to /dev/md127 ? – Mike milkshake Aug 16 '20 at 13:22
  • It means thats working fine will resync - rebuild or you may trigger it manually. – Gediz GÜRSU Aug 16 '20 at 14:36
  • I did the raid1 configuration all over again. Mounted /dev/md0 with /mnt/raid1/. I made a file = /mnt/raid1/raid1.txt . I shutted down the pc plugged again a hdd out. Rebooted the pc. and this is the outcome nextcloudserver:~$ cat /proc/mdstat Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] md0 : inactive sdb1[0](S) 488253464 blocks super 1.2 unused devices: <none> – Mike milkshake Aug 16 '20 at 17:54

Try like this:

  1. Run ubuntu
  2. Run terminal and write
  • Sudo passwd root
  • mdadm –create /dev/md0 -- level=1 --raid-devices=2 /dev/sda1 missing
  • mdadm –create /dev/md1 -- level=1 --raid-devices=2 /dev/sdb1 missing
  1. Install linux. Chouse 1 raid. If you get an error on the middle of the process then write in terminal this:

Ls -l /dev/sd*

mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1

Important: DEV is USB key

df -h

mount --bind /dev /target/dev mount --bind /sys /target/sys mount --bind /proc /target/proc cp /etc/resolv.conf /target/etc/resolv.conf chroot /target/ apt install mdadm grub-install /dev/sda exit then joust reboot the linux.

If you joust add disk to the same group (md0) then use this command:

sudo mdadm --add /dev/md0 /dev/sdc2



So when i plugged one drive out. I wanted to be able to see the dato on the other drive. I plugged one harddrive out, ran cat /proc/mdstat it said in active

then i tried

sudo mdadm -S /dev/md0 to stop it


sudo mdadm -A /dev/md0 to activate it

and mounting the filesystem again sudo mount /dev/md0 /mnt/raid1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.