RAID on NextCloud

Simon Fels simon.fels at
Wed Mar 15 06:13:48 UTC 2017

On 15.03.2017 00:39, Manik Taneja wrote:
> hi there,
> an interesting question came up on askubuntu-
> is the best solution to package mdadm as a snap with core providing
> an interface to /dev/md*? are there alternate solutions?

We had a pretty active discussion a while back when we implemented the
udisks2 interface in snapd. The outcome was that we don't want to give
arbitrary snaps access to block devices and added all access for those
directly into the udisks2 interface (see [0]).

udisks2 offers a mediated way for all other snaps to deal with block
devices and generally also allows working with RAIDs. I say generally,
because this is a feature we didn't verified yet that it is working with
the udisks2 snap currently in the store.

If support for RAIDs in udisks2 works users should be able to mount a
RAID on a directory in /media via an dbus API call.

One downside is that the udisks2 interface explicitly denies plug
connections as it still gives kind of privileged access to the system.
Every mount done via udisks2 will appear below /media and every snap
using the removable-media interface will get access to devices mounted
there, regardless if it's the system partition or not. So even the plug
side is a very privileged thing. That said, snaps can ask for a
snap-declaration on the store side to get connections to udisks2.

Another feature we support with the udisks2 snap is auto-mounting. This
allows a device to say that it wants removable devices like USB storage
device to be automatically mounted in /media as you know it from
consumer oriented devices like the Ubuntu Desktop. Depending on how the
RAID is setup this might be able to get the the RAID mounted on boot
into /media. Requirements for the automounter to consider a device are

 * Device is not a system device (meaning its not a partition on the
device we're booting the system from)
 * Device is not already mounted
 * Device is a removable devices (USB, CD/DVD)

For a very simple, unconfined solution you could just install the
udisks2 snap (given that it detects and works well with RAID devices)
and create a systemd unit in /etc/systemd/system/mount-my-raid.service

Description=Mount my RAID

Exec=/snap/bin/udisks2.udisksctl mount -b /path/to/block/device


Then activate it via

$ sudo systemctl enable mount-my-raid.service

and the RAID should be automatically mounted below /media on the next
system reboot.

I hope this helps.

Btw. I will post this as an answer to the question too.



More information about the Snapcraft mailing list