0

I created a mdadam raid array like this under KDE Neon,

sudo mdadm --create --verbose /dev/md0 --level=0 --raid-devices=3 /dev/sdf /dev/sdg /dev/sdh

I take a look at gparted and am surprised to see that sdg, and sdh have a partition with linux file system linux-raid. But sdf doesn't have any partition.

I created a second raid array as well, so I had these,

/dev/md0
/dev/md1

This is completely data that I don't care about as it is 100% a backup drive, but I do need to build a stable place to backup my data.

After a day or so I restarting my machine and ended up with two raid arrays on my machine (I am using webmin to look),

/dev/md126
/dev/md127

Neither of these are legit because they both show no devices in the array. Plus I created md0 and md1, not md126 and md127.

When I run these commands,

sudo mdadm --examine /dev/md126
sudo mdadm --examine /dev/md127

I get no result.

I recreated md0 and md1, but now when I try to mount,

sudo mount /dev/md0 /media/petermc/Security

I get this,

mount: /media/petermc/Security: wrong fs type, bad option, bad superblock on /dev/md0, missing codepage or helper program, or other error.

This,

sudo mdadm --examine /dev/md0
sudo mdadm --examine /dev/md1

Returns,

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

About the only other thing I can think of that's important at the moment is that these drives are mostly external drives, plus I moved one of the drives to a different USB port.

Open to any advice available. I am contemplating abandoning this approach, and going back to using the drives separately.

2
  • Why are you using /dev/sdX rather thrn /dev?sdX? (ie why are you not partitioning the drives first?
    – davidgo
    Jul 23, 2019 at 20:31
  • It's a lack of understanding to be honest. This is very much a learning experience for me. I did find this, unix.stackexchange.com/questions/320103/… which says mainboards may delete your RAID superblocks if you don't use partitions. I will try rebuilding with partitions as that appears to be the answer.
    – peter
    Jul 23, 2019 at 21:07

1 Answer 1

0

I have pieced together information from google, and have done the setup below in a virtual machine against a fresh KDE neon. Subsequently I have applied this to my server, with good results so far.

When testing in the virtual machine I had some boot issues, so had to revise my setup until this was sorted. Quite simply the issues I had above were because I missed out some important parts of the setup. Most notibly update-initramfs.

My info is based on this with tweaks as required to work with KDE neon,

https://www.tecmint.com/create-raid0-in-linux/

After a clean KDE neon installation I created 3 drives, sdb, sdc, sdd.

First is to create partitions,

e.g. repeat the following on each drive

fdisk /dev/sdb

n (new partition)
P (Primary)
1 (number 1)
Enter (default value)
P (print)

L list
t chose the partition
fd (linux raid auto)
P (print)
w (write)

Create the raid array,

mdadm -C /dev/md0 -l raid0 -n 3 /dev/sdb /dev/sdc /dev/sdd

Check it,

cat /proc/mdstat
mdadm --detail /dev/md0

Create filesystem,

mkfs.ext4 /dev/md0

Mount it,

mkdir /mnt/raid0
mount /dev/md0 /mnt/raid0/

Verify the mount point,

df -h

Add a file to the file system to check it is working,

touch /mnt/raid0/tecmint.txt
echo "Hi everyone how you doing ?" > /mnt/raid0/tecmint.txt
cat /mnt/raid0/tecmint.txt
ls -l /mnt/raid0/

Add an entry into fstab to mount after boot

nano /etc/fstab

The entry in fstab, I created it like this, but upon boot I get an error that defaults is an invalid option,

/dev/md0                /mnt/raid0              ext4    defaults         0 0

This is what worked for me instead based on reading the man pages. This is equivalent to defaults. But for whatever reason defaults didn't work,

/dev/md0                /mnt/raid0              ext4 rw,suid,dev,exec,auto,nouser,async 0 0

Check the mount,

mount -av

Write the raid config to the mdadm config file (this part also differs from the link above, I had to switch to root to do this, and the folder is different),

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

This is when I started to get weird things on boot. The raid array /dev/md0 was not found when booting up which was causing boot delays while it was attempting to initialise. After boot it started to appear as /dev/md126 (which is what I was seeing in my original setup mentioned in my question).

This part is crucial to avoid this,

sudo update-initramfs -u

It's described here https://ubuntuforums.org/showthread.php?t=1764861

As soon as I did that, the boot process works correctly. The raid starts up as /dev/md0 and the mount works. All good.

1
  • In theory this should work, however I build two raid arrays, and one became corrupt after a few days. I have moved to a different approach of keeping all disks separate and not using RAID at all. It's something to consider is staying away from RAID as it does increase the complexity of any system.
    – peter
    Aug 1, 2019 at 5:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .