<p>I'm trying to mount a local directory to be used by a container in kubernetes, but getting this error:</p>

<pre><code>$ kubectl logs mysql-pd

chown: changing ownership of '/var/lib/mysql/': Input/output error
</code></pre>

<p>minikube version: v0.33.1</p>

<p>docker for mac version: 2.0.0.2 (30215)</p>

<p>Engine: 18.09.1</p>

<p>Kubernetes: v1.10.11</p>

<p>I'm starting up minikube with mounted directory:</p>

<pre><code>minikube start --mount-string /Users/foo/mysql_data:/mysql_data --mount
</code></pre>

<p>deployment.yml</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: mysql-pd
spec:
  containers:
  - image: mysql:5.7
    name: mysql-container
    env:
    - name: MYSQL_ROOT_PASSWORD
      value: ""
    - name: MYSQL_ALLOW_EMPTY_PASSWORD
      value: "yes"
    ports:
      - containerPort: 3306
    volumeMounts:
    - mountPath: "/var/lib/mysql"
      name: host-mount
  volumes:
  - name: host-mount
    hostPath:
      path: "/mysql_data"
</code></pre>

<p>As  @Matthew L Daniel mentioned in the comments, the main purpose of using <a href="https://kubernetes.io/docs/concepts/storage/volumes/#hostpath" rel="nofollow noreferrer">hostPath</a> is to mount a local folder from your machine which is hosting minikube inside to the nested Pod, therefore it's not necessary to mount local directory inside to minikube. Also, take a look at this <a href="https://kubernetes.io/docs/setup/minikube/#mounted-host-folders" rel="nofollow noreferrer">article</a> which explains some restrictions about host folder mounting for the particular VM driver in minikube.</p>
