# Elasticsearch not able to use persistent Volume

**URL:** <https://discuss.elastic.co/t/elasticsearch-not-able-to-use-persistent-volume/133390>\
**Category:** Elasticsearch\
**Created:** [May 26, 2018, 12:31pm UTC](https://discuss.elastic.co/t/elasticsearch-not-able-to-use-persistent-volume/133390 "2018-05-26T12:31:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![viggunayak](https://avatars.discourse-cdn.com/v4/letter/v/d07c76/32.png) [@viggunayak](https://discuss.elastic.co/u/viggunayak)\
**Post date:** [May 26, 2018, 12:31pm UTC](https://discuss.elastic.co/t/elasticsearch-not-able-to-use-persistent-volume/133390/1 "2018-05-26T12:31:26Z")

</div>

I m trying to setup an elastic search cluster using a persistent Volume as storage in a kubernetes cluster.  
I have a NFS mount acting as a persistent volume.

I read in the documentation that elastic search uses elasticsearch.yml file and there is a path.data environment variable in that file which can be set to different values (in my case i want to set it to the NFS mount represented by the PV). I am not able to find this file in my system unless i start the deployment.

I m using a set of yaml files to deploy this cluster and create a master node, client node and 2 data nodes along with client service and a master service.

But i see that data is always stored at /usr/share/elasticsearch directory and not at the mount path specified by me in data.yml file.  
How do i specify the elasticsearch to use the NFS mount path to store data while deploying the cluster using kubectl commands

The following is my data yml file.

apiVersion: extensions/v1beta1  
kind: Deployment  
metadata:  
name: es-data  
labels:  
component: elasticsearch  
role: data  
spec:  
replicas: 2  
template:  
metadata:  
labels:  
component: elasticsearch  
role: data  
spec:  
initContainers:  
- name: init-sysctl  
image: busybox:1.27.2  
command:  
- sysctl  
- -w  
- vm.max\_map\_count=262144  
securityContext:  
privileged: true  
containers:  
- name: es-data  
image: [docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.4](http://docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.4)  
env:  
- name: NAMESPACE  
valueFrom:  
fieldRef:  
fieldPath: metadata.namespace  
- name: NODE\_NAME  
valueFrom:  
fieldRef:  
fieldPath: metadata.name  
- name: CLUSTER\_NAME  
value: ebs\_elastic  
- name: NODE\_MASTER  
value: "false"  
- name: NODE\_DATA  
value: "false"  
- name: NODE\_INGEST  
value: "false"  
- name: HTTP\_ENABLE  
value: "false"  
- name: ES\_JAVA\_OPTS  
value: -Xms256m -Xmx256m  
- name: NUMBER\_OF\_SHARDS  
value: "4"  
- name: PROCESSORS  
valueFrom:  
resourceFieldRef:  
resource: limits.cpu  
resources:  
limits:  
cpu: 1  
ports:  
- containerPort: 9300  
name: transport  
livenessProbe:  
tcpSocket:  
port: transport  
initialDelaySeconds: 20  
periodSeconds: 10  
volumeMounts:  
- name: storage  
mountPath: "/data"  
volumes:  
- name: storage  
persistentVolumeClaim:  
claimName: ontap-nfs-elastic1-claim

I see that the data is stored at /usr/share/elasticsearch/data and not in the NFS mount.  
How do i force the elastic search to do this ?

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [May 29, 2018, 4:42am UTC](https://discuss.elastic.co/t/elasticsearch-not-able-to-use-persistent-volume/133390/2 "2018-05-29T04:42:15Z")

</div>

Do not use NFS as a data path for Elasticsearch. It is not supported and known to be problematic. Also, performance will be very bad.

That being said, if you which to use _another_ type of storage you need to mount a volume in `/use/share/elasticsearch/data` which is the data path used by the Docker image.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 26, 2018, 4:42am UTC](https://discuss.elastic.co/t/elasticsearch-not-able-to-use-persistent-volume/133390/3 "2018-06-26T04:42:23Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
