Help with setting up a raid system with Turris Omnia NAS - for a beginner

Please help with the establishment, have:

  • 2 x HGST NAS hard disks each 6TB
  • Turris Omnia NAS
  • Turris Omnia Router

Who can give me a tutorial for beginners?

Thanks to you in advance!

Greeting ritzi

1 Like

If you haven’t done hardware installation part you should start with this:

What are your goals?

12TB or space? 6TB of mirrored space? Encryption? Speed? Usage?

You can get a simple setup going as follows:

Once you have the drives in your NAS router and the NAS router is on, connect via ssh as root:

ssh root@192.168.1.1

List the block devices:

lsblk

You should see sda and sdb , both 5.some TB. Create a mdraid RAID1 device:

mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/sda /dev/sdb

You can now look at the status of your RAID device by

cat /proc/mdstat

It will start with syncing, but it can be used while that’s going on. You will need to create a filesystem in order to put files on the RAID device. Turris Omnia is using btrfs, so we’ll go with that. XFS or ext4 are also ok choices

mkfs.btrfs /dev/md0

Turris Omnia seems to be designed to have non-builtin mass storage mounted at /srv. So:

mount /dev/md0 /srv

And now you can check the status of your system:

df -h
lsblk

You can use LuCI to configure mountpoints to remount automatically when the router is restarted. Look into “System > Mount points”

After reboot you may have to bring up the RAID device:

mdadm --assemble --scan

Any questions? Anyone else have anything to add?

4 Likes

Thanks! You have mentioned disk encryption. Any hints for that?

1 Like

Well, it’s complex. And how do you input the password? Do you want the disks to be accessible if the router restarts? SATA HDD issues

cryptsetup and luks are some of the keywords

well, yes and ideally accessible from other PCs in the local network (W10)… looks like this one is not for beginners to set up?

Hello, why are you suggesting creating raid1 device using mdadm, when the file system will be BTRFS? You can create raid1 directly in BTRFS: mkfs.btrfs -m raid1 /dev/sda /dev/sdb. Using mdadm causes errors on /dev/sdb, which is mentioned in other topics.

I just wrote a very generic Linux RAID guide. Note how I mentioned XFS and ext4. mdadm&mdraid is very stable code that is in use on millions of hosts. If there are errors, the errors are more likely with something else and will probably affect btrfs as well. Has there been any official response from project turris staff regarding these errors?

You are very welcome to write your own instructions.

For my Omnia NAS mdadm works fine with two HGST 2TB disks.

However I’m having issues with ext3 and ext4 in Omnia. I’m still trying to find out what is happening with those filesystems but it is unrelated with mdadm.

Solved this. HGST hard drives that I have are old and quite loud. I noticed from the sound that the hard drives were continuously doing something when the filesystem was mounted and according to /proc/diskstats there were continuous writes to the disks. When I tried other filesystems than ext3 and ext4 these continuous writes disappeared.

It took some work but I finally found out what those writes were. When you create ext3 or ext4 filesystem it is not fully initialized when the mkfs command exits. The kernel continues the filesystem initialization at the background when the filesystem is mounted.

And you’re sure if was the ext3/4 filesystem layer and not mdraid sync after mdadm --create which is visible in /proc/mdstat ?

Yes, i’m sure :slight_smile: I waited the mdadm’s sync to finish before creating the filesystem and I also tested without mdadm. It was “noinit_itable” option for mount that disabled the continuous writes.

I have just asked if there is any reason :slight_smile: Maybe there is something that I don’t know. I have my own experience with mdadm on Turris, where the error appeared during raid initialization, even before creating a filesystem. I have the NAS box perk.

In the case of a single drive being installed (although I’m planning to add a second one in the future), could you please highlight the changes in the instructions you’ve already provided?

Thanks a lot

I managed to mount the disk by following these steps:

Connect via ssh as root:

ssh root@192.168.1.1

Find where my disk was by listing the block devices (in my case sda):

lsblk

Format the disk with BTRFS (again in my case sda):

mkfs.btrfs /dev/sda

And finally mount the disk (again in my case sda):

mount /dev/sda /srv

Then I made the final steps in LuCi to access the disk from my computer

Finally, make sure to change the permissions so that you can read and write on the disk:

chmod 777 /mnt/nas

Here are some modifications of Paul_Totterman’s instructions (thanks!) that highlight how to create a RAID1 (mirrorring) array if you already have data on your harddisk (assuming data is on partition /dev/sdb1). I am using those to migrate my old NAS harddrives to the Turris Omnia NAS:

# Create a “degraded” RAID1 device that uses the ext4 file system:
# WARNING: content of /dev/sda1 DELETED!
mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/sda1 missing
mkfs.ext4 /dev/md0

# Check the status of your RAID1 array
mdadm /dev/md0 --detail

# register raid array in the mdadm config
mdadm --detail --scan > /etc/mdadm.conf

# create a startup script
cat > /etc/init.d/mdadm << EOF
#!/bin/sh /etc/rc.common
START=30
start() {
mdadm --assemble /dev/md0
}
stop() {
mdadm --stop /dev/md0
}
EOF
chmod +x /etc/init.d/mdadm

# enable assembly of raid array at startup
/etc/init.d/mdadm enable

Add the mount point by going to the LuCI GUI, set up /mnt/nas as mount point for the /dev/md0 device. At this stage, the RAID array is usable, although it is missing its second disk.

# Copy your data to the array using Rsync (adapt this command to your needs)
cd /mnt/nas
rsync -avz rsync://192.168.1.111:/mydata/ mydata

When the data copy is finished, physically move the disk that contained “mydata” to the Turris Omnia NAS. We assume the device is now called /dev/sdb (and its partition /dev/sdb1).

# Finally, add the disk/partition to the existing RAID array
# WARNING: content of /dev/sdb1 DELETED!
mdadm /dev/md0 --add /dev/sdb1

# Check the status of your RAID1 array
mdadm /dev/md0 --detail

Now to find out if I can receive notifications upon RAID array failure, etc… This is critical because you won’t notice a thing when a first harddrive fails. When the second one fails, you will notice, but it will be too late!

2 Likes

I think there is an error here. That command doesn’t check the status.

Good catch, thanks, I corrected my post.

I updated my my instructions by explaining how to make the RAID array automatically available when you boot the Turris Omnia. My source for this was a Turris Workshop PDF from Martin Strbačka (2014).

It is possible to create RAID 1 without loosing data? I want mirroring for backups and use it also like lan storage for movies and music.

I have, Turris Omnia, NAS BOX
1x new 4TB WD RED
1x 4TB WD RED split into 2 partitions (1x NTFS with data, 1x exFAT with no data)

Thx for tips.