0

I created a volume and a persistent volume claim. Then I create a MySQL with a map to this volume claim. But the MySQL container does not start because: "2019-11-15T15:08:57.611908Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting." Nevertheless, this is a fresh volume just created into which I have not added anything. How come there is something in it. How to clean it? Thanks for any suggestions. C

Burak Serdar
  • 46,455
  • 3
  • 40
  • 59
Christian68
  • 845
  • 4
  • 13
  • 24
  • The first thing I'd check is whether the volume mounted correctly. It might have mounted as a new directory under where it is supposed to be, like /data/data/, or maybe mounted somewhere else, and you're looking at data left over from a previous run. – Burak Serdar Nov 15 '19 at 15:19
  • you can also mount the PVC into a temporary pod (like a busybox pod) and check if the volume is actually empty. – Patrick W Nov 15 '19 at 15:41

1 Answers1

0

Thanks. Actually, found workaround solution: used the yaml for pod creation that is given here https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/ Then logged into the pod, went to the directory and indeed, there was a "lost+found" directory which I believe is automatically created by Kubernetes. Removed this directory and ensure it is empty. Then started my mysql again ... and it worked.

Christian68
  • 845
  • 4
  • 13
  • 24