How to store ~/.var on a different hard disk?


I need to store ~/.var on a different, larger, hard disk.

I tried a symlink but I get this error bwrap: Can’t make symlink at /home/river/.var: File exists

How can I store it on a second hard disk? Thank you!

I am gonna guess you have the folder in place. Move .var to the filesystem you want to use, and once the folder isn’t in your home then make the symlink.

Have you tried this?

You could try mounting the bigger hard disk at ~/.var , assuming you are an admin of the computer in question to do such a thing

Don’t use a symlink, I suspect that apps that have the --persist=. permission will break. For example, Steam is one of them.

Use a bind mount. If you’re using systemd-homed for the user account, then regular mount mechanisms might not be on the table.
In this case, you can try a fuse bind mount (e.g. bindfs) with a systemd user service.
You’ll likely want to have the systemd service run before any Flatpak app that might be started on login (background portal, dbus, etc), so make sure it starts before flatpak-session-helper.service.
I’m not sure about the performance hit for using fuse, so there’s that.

You could also try pam_mount, though my experience with it is not positive.