OverlayFS help

Hey all, got a Linux/OverlayFS related question maybe I can get some guidance with. I’ve been trying to implement this into my Lakka build for several months now, but I think I’m missing something.

First of all, a bit about my set up – I’m running Lakka version 1.8.4 on the Raspberry Pi 3B+. I run the majority of my ROMs off optical discs, which works great and gives the project a more modular “console-like” feel, but I’m forced to change the Playlists directory to the disc drive to pull it off. This effectively makes the Scanning feature pointless to use for me because I’m unable to write a new .lpl file to the now read-only directory.

I wanted to have the option to scan the ROMs I have “installed” on my USB 32GB flash drive for disc-less operation on the go while still maintaining my own custom RDB database/metadata.

Right now the only way to play “installed” games is to go to “Load Content” and navigate to the flash drive itself to pull up a kind of boring list of folders and files. While this works (especially when set as the Start Directory), it’s not exactly user friendly. I would rather have it be navigated to in the menu, complete with the usual thumbnails and playtime logs.

So this naturally led me into seeing how I could “merge” the default Playlists directory with the one included on my optical discs to give myself the write ability. In theory, I would like “GamePak-0.lpl” to be writable/updatable and always available while “GamePak-1.lpl” and so forth to be from the disc and only appear in the menu when something is physically loaded. The only solution that I can find is OverlayFS, but as mentioned, I think I’m missing something since my Linux isn’t the strongest lol.

Here are the directories I’m working with:

Disc Drive Playlists Path (read-only): /storage/roms/bitdisc_sfmb/GAMEPAK/pro/playlists

Intended Writable Path: /storage/playlists

From what I’ve read about OverlayFS, it looks as if the read-only directory is the “Lower” directory, and the writable path I chose is the “Overlay” – or where the two merged directories would appear. I think my issue is I’m not quite sure where the “Upper” directory goes in Lakka’s file structure (I usually get errors about it not being in fstab). I would imagine this fabled directory is where I would put “GamePak-0.lpl” correct? So here’s what I need help with:

  1. What would be actual command to write for this given the directories I listed above and what’s available on Lakka?

  2. What’s the best way to implement this command and keep it persistent on reboot with Lakka? Autostart.sh?

I would appreciate any help on this since I’ve hit a wall of frustration. I know I’m kind of a fringe use case here trying to bend the way the OS is designed with a single Playlist directory, but having a merged folder for this stuff would greatly expand the versatility. Having deep-dive ROM collections meticulously organized and “final” on a loadable hard copy disc for my library and the ability to cherry pick a custom list from those is a dream of mine. If there’s any other way to implement this, or if this is just simply impossible, please don’t hesitate to let me know haha.

Alright, still plugging away at this problem. Here’s the direct command I’m using:

mount -t overlay overlay -o lowerdir=/storage/roms/bitdisc_sfmb/pro/playlists,upperdir=/storage/roms/playlists2,workdir=/storage/roms/playlists0 /storage/playlists/

And the error I’m getting:

mount: mounting overlay on /storage/playlists/ failed: No such file or directory

I actually get this error no matter what directory I try to mount to. Where the heck am I supposed to put the merged directory at?

“/storage/roms/bitdisc_sfmb/pro/playlists” is my DVD drive and the directory of the playlists folder on the disc.

“/storage/roms/playlists2” is located on my USB Flash drive. So is “playlists0”. Lakka mounts these under the “roms” folder on bootup. “storage/playlists” is the default playlists directory I’m attempting to have those folders merge into.

This seems simple; why isn’t this working?

Looks like I fixed the issue of the command not working (go figure, it was a typo), however, I’m now having the glorious problem of trying to make this stick on reboot.

This is my autostart.sh:

#! /bin/bash (sleep 8; systemctl stop retroarch.service; mount -t overlay overlay -o lowerdir=/storage/roms/bitdisc_sfmb/GAMEPAK/pro/playlists,upperdir=/storage/roms/playlists2,workdir=/storage/roms/playlists0 /storage/playlists systemctl start retroarch.service; export TZ=“America/New_York” ) &

That doesn’t work lol.

EDIT: Forgot a semi-colon at the end of my mount command lol.

SO, I can now confirm to anyone who cares that it’s possible to have TWO active playlist directories via this method. If you need a funky set up for your build, there you go. Personally, I think it’s pretty cool Lakka lets me do this at all lol.

The “correct” way would be to use systemd like Lakka does, you can use one of those as a template:

# systemctl cat tmp-assets.mount > /storage/.config/system.d/tmp-cdrom.mount

Edit that according to your mount point then do:

# systemctl daemon-reload ; systemctl enable --now tmp-cdrom.mount

That way systemd will take care of the mounting (and unmounting).