How to make flatpak or even system packages use SD card

Is there a way to use SD card to install apps.
Or even better is there way to treat EMMC + SD card as contiguous storage? (maybe this is not very convenient)

1 Like

Be warned that I have not tried this.

You should be able to define installation locations by creating a configuration file in /etc/flatpak/installations.d/.



       flatpak-installation - Configuration for an installation location


       flatpak can operate in system-wide or per-user mode. The
       system-wide data is located in $prefix/var/lib/flatpak/, and the
       per-user data is in $HOME/.local/share/flatpak/.

       In addition to the default installation locations, more
       system-wide installations can be defined via configuration files
       /etc/flatpak/installations.d/, which must have the .conf
       extension and follow the format described below.


       The installation config file format is using the same .ini file
       format that is used for systemd unit files or application
       .desktop files.

   [Installation ...]
       All the configuration for the the installation location with name
       NAME is contained in the [Installation "NAME"] group.

       The following keys are recognized:

       Path (string)
           The path for this installation. This key is mandatory.

       DisplayName (string)
           The name to use when showing this installation in the UI.

       Priority (integer)
           A priority for this installation.

       StorageType (string)
           The type of storage used for this installation. Possible
           values include: network, mmc, sdcard, harddisk.


           [Installation "extra"]
           DisplayName=Extra Installation

For example,


[Installation "sdcard"]
DisplayName=Extra Installation

You should be able to install Flatpak to the SD card with:

flatpak install --installation=sdcard

I’m reading further and it seems there is no way to configure install path to be default.
With above mentioned conf approach I’ll always need to specify --installation=

I see mentions for using symlinks to achieve this, but nothing as a part of config itself.

1 Like

If doing this (or anything similar), I recommend that /etc/fstab be used to define a more permanent mount-point for the uSD card.

This has been asked before and you should search out that existing discussion. Conceptually, yes, this can be done but in practice I don’t know whether the needed support is in the kernel and I am almost certain that you would have to set it up manually, and you would also have the complication of combining it all with LUKS assuming that you want an encrypted file system.

It is unclear how you would perform a device backup in this scenario. It should be doable but it would be much more messing around on the host computer. (In any case, if you eventually had a sequence of commands that would set this up on the phone, you should also develop a sequence of commands that would do a device backup.) To clarify that though, just backing up both disks from the phone, fully, would be an adequate backup but you wouldn’t as easily be able to get files out of the backup selectively.

Obviously your phone could become unbootable if you remove the uSD card.

1 Like

From the Tips and Tricks page:

If your custom installation is the only one with the remote you’re installing from, --installation can be omitted.


Exactly what I was hoping for.

1 Like

Please add link to How to make flatpak or even system packages use SD card - #5 by snmc for completion

1 Like

I’ve updated the link in my post and also added the tip to the Librem 5 Tips & Tricks wiki page.


So I’ve tried this method of installing Flatpaks on the SD card and the startup time is noticeably slower. There’s usually a lack of feedback that the app is launching but with some patience, they do launch eventually. My SD card is encrypted, though I don’t know how much that would affect the performance.

1 Like

Thanks for trying it, I’m still being lazy about flashing phone again. I’ll update this thread once I try (hopefully soon) and I don’t use encryption

1 Like

If you use Flatseal to manage Flatpak permissions, apps may not be listed and you will need to grant Flatseal the host:ro filesystem permission.

Flatseal Documentation

flatpak --user override --filesystem=host:ro com.github.tchx84.Flatseal

Technically speaking whether the SD card is encrypted is independent of whether the eMMC drive is encrypted - and you can change the encryption on the SD card without reflashing the phone.