RFC: Using external storage with FreedomBox applications

Summary

Allow FreedomBox applications primarily intended for downloading and sharing files to use a shared storage location on external disks to store their data.

Note: Some technical details about implementation are omitted to avoid bias in implementation plans and to make the plan accessible to all readers. Implementation details will be discussed in the issue tracker after receiving comments on this.

Problems

  1. FreedomBox currently uses only one disk to store application data.Though there is support for adding additional disks, the system is not equipped to use it as additional storage.
  2. Files downloaded by one application are not accessible to others. Currently, the only way to get around this limitation is using the Sharing app.

Solution

When a user adds a new disk to their FreedomBox, an option will be presented in the Storage module to use the disk for application data storage (similar to how one would use expandable storage in Android devices). A directory called FreedomBox will be created on the external disk with a special set of permissions. The directory and its children will be owned by a user group called freedombox-share of which all the file sharing applications are members. Our current candidates for this are:

  • Deluge
  • Transmission
  • MLDonkey
  • Syncthing
  • Sharing

There can be any number of directories under the FreedomBox directory. Like Syncthing folders, BitTorrent download folders, Sharing folders etc. with arbitrary overlap. All the above apps will be able to read and write to folders under the FreedomBox directory.

Example Use Cases

  1. View photos and videos from your phone on the TV.
    Explanation: The Camera folder from the user’s phone is synced to their FreedomBox using Syncthing. The Sharing app makes it available to the TV over uPnP.
  2. Download a video using Transmission to FreedomBox and watch it on TV.
    Explanation: A directory like FreedomBox/Videos is set as the downloads folder in Transmission and is also shared using the Sharing app which makes it available to the TV using the uPnP protocol.
  3. Share a large file from one of the Syncthing folders using Transmission.
  4. Play multimedia files (downloaded by whatever application) in the browser using the Sharing app.
  5. Some future applications for music streaming, photo sharing etc. can make use of media in folders synced from smartphones and other computers.

I haven’t used MLDonkey yet but I imagine the use cases will be similar to Transmission.

Directory Browser

Once an external disk is configured for FreedomBox storage, a user should be able to use it with applications. A directory browser will help users choose the directory to download to or share from.

The UI will be similar to what is presented in Gnome when a user clicks on a file selector in a web page (the Browse button). This UI component will be made available in all of the above mentioned apps.

First, a user chooses the disk they want to use (only among the configured disks). The Directory Browser will detect and jump to the FreedomBox directory on the disk. The user can pick one of the existing directories or create a new one.
(Advanced) The user can also choose any other arbitrary location if they are sure about the path and its permissions.

Spike

I checked that it is possible to create a directory and set ACL rules on it such that a group of users will be able to use it as a common storage. I tested this configuration by using a common directory for Transmission and Syncthing.

3 Likes

Sounds good.

If we can avoid ACLs and implement this with regular unix file/directory ownership and permissions, then it will make things simpler.

No idea on the tecnical side, but this is definitely a gamechanger. The filebrowser makes things much easier for people who come from a desktop or mobileOS background. And the propper integration of external storage basically makes it replase a NAS, as i understand it.

I love this idea. I would also keep Disk encryption on the radar. Once a specific storage is chosen, a user should be able to encrypt it.

One thing I don’t like is permissions by apps. It should be by user. The encryption, also.

Finally, all user data should exist there. I’d hate to lose my Synapse chats if my freedom box SD fails, along with synced files and whatsoever.

Hi,
I think a filesystem directory sharing is a really great idea.

With some tweaks I think Debian can supports it very well.
I even found something about how to set up group directory creation in the Debian Wiki:
https://wiki.debian.org/DebianDesktopHowTo#A.28Locally_Shared.29_Group_Directories

What I didn’t understand yet is, why would the group directories only work with external storage, and not already on the first filesystem?

If the directory sharing could work already on the first filesystem, and the system uses the default btrfs filesystem, the directory sharing could work in the same way no matter how the storage devices are set up.

(Btrfs storage devices can be added to a running system to add storage space or redundancy.
And after adding a new device, unneeded, old or small devices can be removed, also without affecting the running system.)

Apart from explaining how easy group collaboration permissions work behind the scenes, this shows a nice directory structure that enables collaboration in /home subdirectories (section “Using User Private Groups”):
https://wiki.debian.org/UserPrivateGroups#Enabling_User_Private_Groups

1 Like