How to move /var/lib/influxdb to a different location?

I need to move my database to a different partition.
So my idea was to rsync everything over to let’s say /mnt/influxdb and then create a symlink from /var/lib/influxdb to /mnt/influxdb
But starting the service via systemd fails with no specific reason.
Testwise I started /usr/lib/influxdb/scripts/influxd-systemd-start.sh
But I get the following error message, probably because I cannot start the script as user influxdb:
2023-05-26T23:05:42.961669Z info Unauthorized {“log_id”: “0i2_cjaG000”, “error”: “authorization not found”}

What needs to be done to accomplish what I want?

Hello @penholder,
I’m not sure. I haven’t seen a user try that before I don’t think I’m asking around.

I don’t understand. Why would you have to ask around?
I’d just like to know why this obvious method (creating a symlink to the new location) doesn’t work with influxdb.
Creators of the db would know if there are hardcoded dependencies to the original location.

Rather than using symlinks, I would suggest using the configuration options for bolt-path, engine-path and sqlite-path to tell influxd where the new files are located.

@Jeffrey
Could you please elaborate why?
Symlinks seems easier to me. Since I know what I’m doing. And the other option seems rather complicated.

Instead of symlinks you could also try bind mounts. They usually work more reliable than symlinks as they are transparent to the application.

1 Like

@Alestrix
Excellent tip.
Thank you very much!