Restic mounted filesystem for 'real use'

Hello all,
i have a bunch of media files which i edit and manage locally. I backup them with restic to a hetzner storage box and want to show them in my nextcloud server (read only) , which also lives at Hetzner.

The storage box with the restic repos is mounted (via CIFS) to the nextcloud server. Because ‘real storage’ is quite expensive and speed is not the utmost concern here I thought about the following plan:

Mount the latest snapshot of the restic repo somewhere in the file system, use this place as ‘external storage’ in nextcloud.

This works in principle. On the command line I do for example

restic mount   --allow-other \
        --repo /mnt/restic/text \
        --password-file /root/restic/media.passwd \
        /mnt/cache/text/ &

Nextcloud accepts this directory as a ‘local’ directory and shows the data.It is not a fast a usual of course, but seems good enough.

root@xxxx:~# lsof /mnt/cache/text/
COMMAND      PID     USER   FD   TYPE DEVICE SIZE/OFF                 NODE NAME
php-fpm8. 295088 www-data    8r   DIR   0,41        0 13216247994100858702 /mnt/cache/text/snapshots/2022-01-12T09:56:09Z/mnt/media/texts/edition_gutenberg_de/Edition15

But what happens when a new version in the repository occurs ?

I think, i have to kill the restic mount process every night or so and start again to get the newest snapshot. Is this correct ?

For testing purposes I killed the mount process, while nextcloud ran and nextcloud noticed the problem , kept running and when I mounted again, showed the external storage again.Nice!

I presume this sounds a little bit crazy but I am quite satisfied so far.

Any Ideas or tipps for a scenario like this ?

Thanks for reading

Norbert

This does sound wild indeed but, hey, why not? I guess I’d do it just like that.

I would imagine that I’d try to use /mnt/external as the external storage folder and then mount restic in /mnt/external/restic or something like that. Nextcloud should not complain if files inside the external storage folder change, right?

The mount command reloads the snapshots and index from repository from time to time. That is new snapshots should automatically appear after some time.

2 Likes

That is really cool and solves the problem nicely.

This questions led to this recipe

1 Like