Suggestions for integrating SD Card storage?

I’ve got my Librem 5 set up with FDE and expanded the LUKS partition to use the full internal disk, using the instructions provided on this forum.

However, I’m thinking that the internal disk might still not be enough for the combination of applications, personal data, and downloads I will have. Some apps, like Gnome podcasts, don’t seem to provide a means to change the directory where podcasts are downloaded to - meaning I couldn’t point it to the sd card. There also doesn’t seem to be a way to delete podcasts so they’ll just keep piling up till they eat up the whole disk.

Is it possible to do any of these options:

  1. Span the LUKS partition across both the internal storage and SD card
  2. Move the default user’s home directory to the SD Card. If I have the sd card encrypted separately, I’m wondering if I could even get past the lock screen to enter the password to mount the SD card. Unless there’s some way to use the smart card reader to do this automatically in the background?
  3. Move specific applications to the encrypted SD card

What is everyone else doing?

This would be easier if I could just install the whole OS to a large SD Card and boot from that, but that’s not possible from what I have been able to glean from forum posts.

That has been shown to be troublesome but doable. Search for the existing discussion.

You can partition the uSD card and then mount the various uSD card partitions in places in the file system that will help.

In particular cases, you may be able to get away with using a symbolic link from something in your home directory to the uSD card.

(However it would be my advice to avoid doing either of those with any part of your home directory that is needed to bring up the GUI and definitely don’t do that with any part of the operating system or software that it depends on.)

So it should be relatively safe to mount or symbolic link Downloads to the uSD card - if that is relevant to where Gnome podcasts is downloading to.

I believe that is a high degree of difficulty but, again, doable. You can’t, as I understand it, boot directly from the uSD card, because the bootloader does not support it but if the bootloader boots the /boot partition of the eMMC drive, you may be able to chain boot to the uSD card. There’s no way that I am able to provide instructions for that however.

Having spent a fair bit of time playing around with Raspberry Pi devices, I would never be completely comfortable with depending on a uSD card. Or at least I would hope that the Librem 5 is more robust than the Raspberry Pi in that respect. I’ve had to restore the uSD card of a Raspberry Pi more than once after the card contents became corrupt.

At the current time, my only requirement is for music media for the Lollypop application and that application is perfectly capable of using a directory on the uSD card, so no challenge for me.

(Because this content is all public content anyway, there is no pressing need to encrypt it but encryption would definitely be an additional challenge. I’m prepared to leak the “meta information” regarding my choice in music in the event that my phone is lost or stolen. I will probably eventually partition the uSD card and make part of it encrypted and part of it not encrypted, in case I do need to store some confidential information.)

I’ve just used symlinks tio the sd card for things I want stored there.
For example if you have the sd card mounted as /sd_card:

mv Pictures /sd_card/
ln -s /sd_card/Pictures

That will cause all pictures to go to the sd card. It also has the advantage of should the sd card fail your phone is still usable.

1 Like

Option 2 is definitely possible as that is what I have done.

I have the uSD card encrypted separately and use a key file to unlock it, the LUKS container of the uSD card has an entry in `/etc/crypttab’ and the key file lives on the encrypted root file system. After the root file system is unlocked during boot, the uSD card is then automatically unlocked when ‘/etc/crypttab’ is parsed.

Once the uSD card is unlocked, I have a systemd unit shadow mount the card as the ‘/home’ directory.

If the card is removed, becomes corrupt to the extent that it cannot be unlocked or is rendered unreadable in some other way, the system falls back to using the ‘/home’ directory of the root file system.