title: How to mount a postgresql volume using Aws EBS in Kubernete
body: <ol>
  <li>I've created the persistent volume (EBS 10G) and corresponding persistent volume claim first. But when I try to deploy the postgresql pods as below (yaml file) :</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/1bM88.png" rel="noreferrer">test-postgresql.yaml</a></p>
  
  <p>Receive the errors from pod:</p>
  
  <p><strong>initdb: directory "/var/lib/postgresql/data" exists but is not empty
  It contains a lost+found directory, perhaps due to it being a mount point.
  Using a mount point directly as the data directory is not recommended.
  Create a subdirectory under the mount point.</strong></p>
  
  <p>Why the pod can't use this path? I've tried the same tests on minikube. I didn't meet any problem.  </p>
  
  <ol start="2">
  <li>I tried to change volume mount directory path to "/var/lib/test/data", the pods can be running. I created a new table and some data on it, and then killed this pod. Kubernete created a new pod. But the new one didn't preserve the previous data and table. </li>
  </ol>
  
  <p>So what's the way to correctly mount a postgresql volume using Aws EBS in Kubernete, which allows the recreated pods can reuse initial data base stored in EBS?</p>