Change of data directory not working for InfluxDB

Hi, I am trying to change the data path for InfluxDB addon to an external SSD drive connected to my Pi. I need this as I dont want InfluxDB to be writing to my SD Card and shorten its life. While if I leave the config to defaults , InfluxDB works well , when I change the paths using envars , it does not start up , nor does it throw up an error in the logs
My env is : Raspberry Pi 3 , Hassio , Docker , InfluxDB add on

My configs are as under:

My fstab entries which mounts the external drive:
UUID=8f9c583f-d05c-4bcb-8533-1f43a6cb6994 /mnt/data ext4 defaults,nofail,auto,users 0 0
My mount is working fine , I have verified that although I am not sure if there are permission issues from the user from home assistant as I dont know which user id used to access the drive.

My InfluxDB config:

  "auth": true,
  "reporting": true,
  "ssl": true,
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  "envvars": [
      "name": "INFLUXDB_DATA_DIR",
      "value": "/mnt/data/influxdb/data"
      "name": "INFLUXDB_META_DIR",
      "value": "/mnt/data/influxdb/meta"
      "name": "INFLUXDB_DATA_WAL_DIR",
      "value": "/mnt/data/influxdb/wal"

I have also verified the influxdb.conf inside the docker container and it does not contain the directories I am setting via the envars entry, not sure why is that so

root@a0d7b954-influxdb:/etc/influxdb# cat influxdb.conf
reporting-disabled = false
  dir = "/data/influxdb/meta"

  dir = "/data/influxdb/data"
  engine = "tsm1"
  wal-dir = "/data/influxdb/wal"

  realm = " InfluxDB"
  flux-enabled = true


My logs show the following and nothing after this:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] executing... 

----------------------------------------------------------- Add-on: InfluxDB
 Scalable datastore for metrics, events, and real-time analytics
 Add-on version: 3.5.1
 You are running the latest version of this add-on.
 System: Raspbian GNU/Linux 10 (buster)  (armv7 / raspberrypi3)
 Home Assistant version: 0.103.6
 Supervisor version: 195
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
[cont-init.d] exited 0.
[cont-init.d] executing... 
[cont-init.d] exited 0.
[cont-init.d] executing... 
[cont-init.d] exited 0.
[cont-init.d] executing... 
[cont-init.d] exited 0.
[cont-init.d] executing... 
[cont-init.d] exited 0.
[cont-init.d] executing... 
[cont-init.d] exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[23:52:13] INFO: Kapacitor is waiting until InfluxDB is available...
[23:52:13] INFO: Chronograf is waiting until InfluxDB is available...
[23:52:13] INFO: Starting the InfluxDB...

A point to note that if I put in the defaults, then InfluxDB works fine.
Can somebody help please?

I have read some posts and it seems , it isnt possible to map an external mount directory to a volume within docker - i think a hassio limitation.
I can see using portrainer that my /data directory in influxdb is still mapped as :

Host/volume                                              Path in container
/usr/share/hassio/addons/data/a0d7b954_influxdb          /data
/usr/share/hassio/ssl                                    /ssl
/usr/share/hassio/share                                  /share

The strange part is , wht isnt the addon throwing up any error? It is stuck at Starting InfulxDB stage…

Can anybody help please?

Hi Vijay,

Something similar happened to me when I was setting up the InfluxDB add-on. Have you tried setting auth to false, just for your initial startup run? Once you do that and create your InfluxDB user account, you can stop the add-on, enter your credentials in configuration.yaml, re-enable auth for InfluxDB, and then restart Home Assistant. That worked for me, anyway…you might give it a shot.

Thanks for the suggestion mate. I have moved on to shifting my entire installation to a SSD now. Nevertheless , I would still want to have the Influx data into a directory of my choosing than the default so will try this some day.

I have the same problem on Raspberry Pi 3B installation since a few months. It stops in that point (Starting the InfluxDB…) for a loooong time using almost all the CPU (more than 90%) and a lot of memory. Finally when it starts it is unusable and I have to reboot and not using InfluxDB for keeping the system stable. Other times I have to restart the machine before complete starting the InfluxDB.
Sorry, I do not know how to get InfluxDB usable again at the moment.

Hi, anyone that has made any progress on moving influxdb database to a different location? Tried to get it running with the envvars but was forced to remove it from the configuration to enable influxdb to start.

Same issue here. I can’t get a working mounted directory. Tried it, but it just created the /mnt/bigstorage/influxdb/ folder instead of using the host-mounted one. Seems it’s not possible to mount a drive while starting the influxdb addon container…