# Change data directory

**URL:** <https://community.influxdata.com/t/change-data-directory/15254>\
**Category:** InfluxDB 2\
**Created:** [July 14, 2020, 9:03pm UTC](https://community.influxdata.com/t/change-data-directory/15254 "2020-07-14T21:03:11Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![xHackYx](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/xhackyx/32/7206_2.png) [@xHackYx](https://community.influxdata.com/u/xHackYx)\
**Post date:** [July 14, 2020, 9:03pm UTC](https://community.influxdata.com/t/change-data-directory/15254/1 "2020-07-14T21:03:12Z")

</div>

Hey Guys,

i am trying to change the data directory for my new set up InfluxDB.

I changed the Path on the InfluxDB.config to my preferences.  
And tried

> sudo chown influxdb:influxdb /media/4tb/influxdb/

but I get the following error

> chown: changing ownership of ‘/media/4tb/influxdb/’: Operation not permitted

any help with that ?  
im running on ubuntu 18.04 but I a linux noob 🙂

Thanks!

---

<div class="post-metadata">

**Author:** ![Pooh](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@Pooh](https://community.influxdata.com/u/Pooh)\
**Post date:** [July 14, 2020, 9:36pm UTC](https://community.influxdata.com/t/change-data-directory/15254/2 "2020-07-14T21:36:13Z")

</div>

Is that 4tb device:

a) mounted read-only

b) not an EXTn file system?

Antony.

---

<div class="post-metadata">

**Author:** ![xHackYx](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/xhackyx/32/7206_2.png) [@xHackYx](https://community.influxdata.com/u/xHackYx)\
**Post date:** [July 14, 2020, 9:49pm UTC](https://community.influxdata.com/t/change-data-directory/15254/3 "2020-07-14T21:49:38Z")

</div>

its mounted read / write.

Its an exfat filesystem.

---

<div class="post-metadata">

**Author:** ![Pooh](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@Pooh](https://community.influxdata.com/u/Pooh)\
**Post date:** [July 14, 2020, 10:29pm UTC](https://community.influxdata.com/t/change-data-directory/15254/4 "2020-07-14T22:29:13Z")

</div>

There’s your answer, then.

You can’t change the ownership on an exfat system.

The only way I can think to achieve what you want is to mount it as the  
influxdb user, not as root (or anybody else).

Antony.

---

<div class="post-metadata">

**Author:** ![shiftsystems](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/shiftsystems/32/5317_2.png) [@shiftsystems](https://community.influxdata.com/u/shiftsystems)\
**Post date:** [July 15, 2020, 3:36am UTC](https://community.influxdata.com/t/change-data-directory/15254/5 "2020-07-15T03:36:16Z")

</div>

if you plan on using the drive exclusively with Linux systems then you can format the drive as an ext4 volume and try again

---

<div class="post-metadata">

**Author:** ![xHackYx](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/xhackyx/32/7206_2.png) [@xHackYx](https://community.influxdata.com/u/xHackYx)\
**Post date:** [July 15, 2020, 6:27am UTC](https://community.influxdata.com/t/change-data-directory/15254/6 "2020-07-15T06:27:04Z")

</div>

alright I try that thanks guys

---

<div class="post-metadata">

**Author:** ![xHackYx](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/xhackyx/32/7206_2.png) [@xHackYx](https://community.influxdata.com/u/xHackYx)\
**Post date:** [July 15, 2020, 11:07am UTC](https://community.influxdata.com/t/change-data-directory/15254/7 "2020-07-15T11:07:59Z")

</div>

I used ext4 and it works now but when I try to start the dbservice I get the following:

```
    timo@fileserver:~$ sudo systemctl status influxdb
● 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 Wed 2020-07-15 11:02:52 UTC; 2s ago
     Docs: https://docs.influxdata.com/influxdb/
  Process: 1710 ExecStart=/usr/bin/influxd -config /etc/influxdb/influxdb.conf $INFLUXD_OPTS (code=exited, status=1/FAILURE)
 Main PID: 1710 (code=exited, status=1/FAILURE)

Jul 15 11:02:52 fileserver systemd[1]: influxdb.service: Service hold-off time over, scheduling restart.
Jul 15 11:02:52 fileserver systemd[1]: influxdb.service: Scheduled restart job, restart counter is at 5.
Jul 15 11:02:52 fileserver systemd[1]: Stopped InfluxDB is an open-source, distributed, time series database.
Jul 15 11:02:52 fileserver systemd[1]: influxdb.service: Start request repeated too quickly.
Jul 15 11:02:52 fileserver systemd[1]: influxdb.service: Failed with result 'exit-code'.
Jul 15 11:02:52 fileserver systemd[1]: Failed to start InfluxDB is an open-source, distributed, time series database.
```

---

<div class="post-metadata">

**Author:** ![Pooh](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@Pooh](https://community.influxdata.com/u/Pooh)\
**Post date:** [July 15, 2020, 4:05pm UTC](https://community.influxdata.com/t/change-data-directory/15254/8 "2020-07-15T16:05:51Z")

</div>

I’ll have to step back and let someone else respond regarding this, as I’ve  
never used systemd for managing services.

Antony.

---

<div class="post-metadata">

**Author:** ![marcelr](https://avatars.discourse-cdn.com/v4/letter/m/eada6e/32.png) [@marcelr](https://community.influxdata.com/u/marcelr)\
**Post date:** [September 10, 2020, 10:40pm UTC](https://community.influxdata.com/t/change-data-directory/15254/9 "2020-09-10T22:40:04Z")

</div>

Hello,

I’m currently using the configuration below, and I haven’t had any problems so far, I hope it helps you

My service **lib/systemd/system/influxdb2.service**

> [Unit]  
> Description=INFLUXDB2
> 
> [Service]  
> Type=simple  
> ExecStart=/bin/bash /var/InfluxDB/run.sh
> 
> [Install]  
> WantedBy=multi-user.target

and inside the bash script ( **/var/InfluxDB/run.sh** ) I added the parameters that I need

`/usr/local/bin/influxd --http-bind-address=:8086`

```
● influxdb2.service - INFLUXDB2
     Loaded: loaded (/lib/systemd/system/influxdb2.service; disabled; vendor preset: enabled)
     Active: active (running) since Fri 2020-07-31 23:25:41 -03; 1 months 10 days ago
   Main PID: 416225 (bash)
      Tasks: 54 (limit: 4620)
     Memory: 545.3M
     CGroup: /system.slice/influxdb2.service
             ├─416225 /bin/bash /var/InfluxDB/run.sh
             └─416236 /usr/local/bin/influxd --http-bind-address=:8086

```
