Brand new user to Influx… only moderate technical skill level…
I’ve successfully installed InfluxDB v2 and Telegraf to a Pi4B by following the tutorials available at “Random Tutorials” [and I can’t provide the link as I’m a new user sorry…] and everything has gone smoothly. However, I’ve upgraded my Pi4B with a USB-connected M.2 drive that I’ve mounted to “/media/local” … and I would like to be able to set up my Pi so that Influx data is written to the M.2 drive and not to the MicroSD card, because of course the M.2 drive is designed for much higher write volumes.
I already have a folder /media/local/Data that is set up … and I’ve successfully migrated my /home/{user}/.influxdbv2 folder to this location, using a softlink.
I then stopped the DB using “sudo systemctl stop influxdb”, confirmed it had shut down safely using “sudo systemctl status influxdb” and set about copying the entire contents of /var/lib/influxdb to a folder located on the M.2 drive, using
“sudo cp -r influxdb /media/local/Data/influx/influxdb/”
which seemed to work just fine. I used “sudo -h” to set the permissions of the softlink in the /var/lib folder.
I then went in to the newly cloned “influxdb” folder and compared the file ownership and access permissions between the new copy and the original content in /var/lib/influxdb. To my eye - human error notwithstanding - the two folder structures appear to be exactly the same.
I’ve then attempted to restart influxdb with “sudo systemctl start influxdb” but I’m getting an error, which reads:-
Job for influxdb.service failed because the control process exited with error code.
See “systemctl status influxdb.service” and “journalctl -xe” for details.
When I check for status, this is what I see:
$ sudo systemctl status influxdb.service
● influxdb.service - InfluxDB is an open-source, distributed, time series database
Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2025-01-18 12:25:13 GMT; 11s ago
Docs: InfluxDB OSS v2 Documentation
Process: 17957 ExecStart=/usr/lib/influxdb/scripts/influxd-systemd-start.sh (code=exited, status=238/STATE_DIRECTORY)
CPU: 4ms
Jan 18 12:25:13 server systemd[1]: influxdb.service: Scheduled restart job, restart counter is at 5.
Jan 18 12:25:13 server systemd[1]: Stopped InfluxDB is an open-source, distributed, time series database.
Jan 18 12:25:13 server systemd[1]: influxdb.service: Start request repeated too quickly.
Jan 18 12:25:13 server systemd[1]: influxdb.service: Failed with result ‘exit-code’.
Jan 18 12:25:13 server systemd[1]: Failed to start InfluxDB is an open-source, distributed, time series database.
I’ve checked the status of /usr/lib/influxdb/scripts/influxd-systemd-start.sh - the one identified in the “Process” element of the systemctl status check - and it looks OK.
After I hit this problem I did the obvious and started searching - and I came up with this thread:
One of the replies suggests that the user “try bind mounts” - and apparently this works, but I’m not entirely sure what this involves… and the thread doesn’t go in to any details.
I would be incredibly grateful if anyone who has been through this process could give me some suggestions as to what I might be able to do in order to make this work please?
I’m not sure if it is relevant… but if I go back to /var/lib and change from symlink to original folder, everything runs flawlessly, so I’m pretty sure that the issue lies there somewhere.
Any suggestions gratefully received.
Thanks in advance.