RAID on NextCloud
Simon Fels
simon.fels at canonical.com
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-
>
> https://askubuntu.com/questions/888404/ubuntu-core-with-raid-1?rq=1
>
> 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
currently:
* 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
[Unit]
Description=Mount my RAID
[Service]
Exec=/snap/bin/udisks2.udisksctl mount -b /path/to/block/device
[Install]
WantedBy=multi-user.target
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 askubuntu.com question too.
regards,
Simon
[0]:
https://github.com/snapcore/snapd/blob/master/interfaces/builtin/udisks2.go
More information about the Snapcraft
mailing list