This is the issue with the quad sata hat and raspbian

I had this same problem. The issue is the rockpi-sata.service must be running before you can mount the RAID. I couldn’t figure out how to accomplish this while still using fstab to mount the drive, but I’ve figured out how to mount the raid using systemd instead. systemd allows you to configure dependencies and boot orders. Here is an article that helped me figure it out Mounting Linux Volumes with systemd vs fstab. and here is my nas.mount file:

[Unit]
DefaultDependencies=no
Conflicts=umount.target
After=rockpi-sata.service
Before=local-fs.target umount.target

[Mount]
What=/dev/md0
Where=UUID="a545f596-12fb-4e1e-ab6f-a3183a0efbce"
Type=ext4
Options=defaults,noatime

# Make 'systemctl enable nas.mount' work:
[Install]
WantedBy=local-fs.target
1 Like

very efficiency setup, thank you. I will also add it inside services file of OVM (to be more secur).

I got the same problem today and then I found this post.

It has been 12 days since setq said they will update the script. Why they haven’t done it yet?

Is there any way to save my installation and avoid redoing the whole thing again?

Please advise.

i used ext2fsd to mount my root file system on the sd card from windows and commented out the mount commands in fstab, i then boot normally and move the mount commands to fc.local so they run after the hat service starts

Is it better to add them in fc.local or in systemd?

Yes check this link How i fixed the hang at boot and got my sata hat working with unionfs

I will prepare a wiki section to OVM+SATA HAT+disks managment soon : when my system is stable :slight_smile:

Hi, I managed to make it work using this solution with my raid10 and the nas mount file.

The problem is that after I rebooted the raid started resynching again from 0.0% and I have to wait 12 hours.

Did this happen because I created a new file system? Will it happen next time I reboot?

I can’t reboot till syncing is finished to test it again.

have use uuid of disk ? or Label ?

I have 4 x 2 TB disks and I created a Raid 10 with mdadm (md0).

I created a filesystem via OMV named dm-0. Then I created a nas.mount file under /etc/systemd/system with the following configuration:

[Unit]
DefaultDependencies=no
Conflicts=umount.target
After=rockpi-sata.service
Before=local-fs.target umount.target

[Mount]
What=/dev/dm-0
Where=UUID=“f1bfba39-9471-420a-ae4f-8b317b609b2d”
Type=ext4
Options=defaults,noatime

[Install]
WantedBy=local-fs.target

and I removed the entry from fstab file.

I shutdown the pi and after reboot the file system was automounted in OMV (this is what I was expecting) but the Raid started syncing again starting from 0.0%. I don’t know what caused this.

I didn’t use the other solution with unionfs and rc.local file.

not expert un mdadm but did you used uuid to make the NAS with mdadm ?

Yes.

I would have created the RAID in OMV but even though the disks were showing up it couldn’t find them under the RAID management. Weird!

Hi. I tried to work around this issue with systemd as you proposed but I get the following message with dmesg:

/etc/systemd/system/nas.mount:8: Where= path is not absolute, ignoring: UUID=“f1bfba39-9471-420a-ae4f-8b317b609b2d”

Any idea why?

Ok after some reading I found out that the configuration file’s name must have the mount point’s name. This is my configuration that works fine and loaded by the system properly:

[Unit]
DefaultDependencies=no
Conflicts=umount.target
After=rockpi-sata.service
Before=local-fs.target umount.target

[Mount]
What=/dev/disk/by-uuid/f1bfba39-9471-420a-ae4f-8b317b609b2d
Where=/srv/dev-disk-by-label-storage
Type=ext4
Options=defaults,noatime

[Install]
WantedBy=local-fs.target

If your mount point is /home/nas then the configuration file name should be home-nas.mount
Beware of cases like mine that the mount point has ‘-’ characters. Then these characters should be as \x2d in the filename.

So for my mounting point /srv/dev-disk-by-label-storage the filename is srv-dev\x2ddisk\x2dby\x2dlabel\x2dstorage.mount

After you need to run:
systemctl start status and enable for the mount file. For cases like mine with - in filename you call the filname within single quotes. example:

systemctl start ‘srv-dev\x2ddisk\x2dby\x2dlabel\x2dstorage.mount’
systemctl status ‘srv-dev\x2ddisk\x2dby\x2dlabel\x2dstorage.mount’
systemctl enable ‘srv-dev\x2ddisk\x2dby\x2dlabel\x2dstorage.mount’

2 Likes

Thx for this tip, works like a charm. Only thing I’m wondering now: does it properly unmount when you stop the rock-pi service? Or does it still just “pull the plug” from the disks?

Also may I suggest a:

sudo systemctl daemon-reload

after adding/editing the .mount files

EDIT: It seems the disks get unmounted when stopping the rock-pi service. But don’t remount automatically when restarting service. So… need to look into systemd kind of “post” start if something like that would exist.

just encase this helps someone else
using the above
"# This file is part of systemd.

systemd is free software; you can redistribute it and/or modify it

under the terms of the GNU Lesser General Public License as published by

the Free Software Foundation; either version 2.1 of the License, or

(at your option) any later version.

[Unit]
DefaultDependencies=no
Conflicts=umount.target
After=rockpi-sata.service
Before=local-fs.target umount.target

[Mount]
What=/dev/md0
Where=UUID=“3c3a3c08-2aff-4bd6-a68c-5ad8eddb2123”
Type=ext4
Options=defaults,noatime

Make ‘systemctl enable mnt-raidx.mount’ work:

[Install]
WantedBy=local-fs.target"

mounts to /mnt/raidx
file name:
mnt-raidx.mount

hi on reboot it didnt auto load annoyingly

how do I get that to happen?

Failed to enable unit: File /mnt/raidx: Invalid argument
when trying to do enable

Your “where” is an invalid mointpoint.

Also use the md0’s uuid in the “what” section. To prevent inconsistencies between reboot.

ok I get what you mean now

changed it

/etc/systemd/system/multi-user.target.wants

changed the after section to this:

[Unit]
Description=MiniDLNA lightweight DLNA/UPnP-AV server
Documentation=man:minidlnad(1) man:minidlna.conf(5)
After=mnt-raidx.mount

cool worked

appreciate the help I had trouble finding it

You can get a a mount path escaped version (which is used in a systemd service) with the systemd-escape --path <path_goes_here> (without <>) command is your mount path has a complicated name.

1. Example (simple):
pi@raspberry-pi-4:~ $ systemd-escape --path /mnt/radix
mnt-radix

2. Example (with a space in the folder name):
pi@raspberry-pi-4:~ $ systemd-escape --path “/mnt/radix 2”
mnt-radix\x202

So you have to write After=mnt-radix\x202.mount into the service file in this case.

In my case for qBittorrent, I had to add the following too (BindsTo):

After=network.target network-online.target nss-lookup.target mnt-torrent.mount
BindsTo=mnt-torrent.mount

I had to write BindsTo with my mount point path.

1 Like

yea its weird I find not all my services work 100% i.e. sometimes my vpn doesnt auto start and other times its my raid auto mounting, a bit annoying but I cba to fix it anymore lol so I just reboot till it works sometimes