diff --git a/docs/setup.md b/docs/setup.md index 1dc33b4c74..564538cb0b 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -91,13 +91,22 @@ Use this command to confirm the mount point exist: $ mount | grep /mnt/disks/local-pv01 ``` -To auto-mount disks when your operating system is booted, you should edit `/etc/fstab` to include these mounting info: +### Auto-mount on reboot +To auto-mount disks when your operating system is booted, you should edit `/etc/fstab` to include these mounting info. + +Disk mount: +```shell +$ echo "/dev/nvme0n1 /mnt/disks/disk01 ext4 defaults 0 0" >> /etc/fstab +``` + +Bind mount: ```shell -$ echo "/dev/nvme0n1 /mnt/disks/disk0 none bind 0 0" >> /etc/fstab $ echo "/data/local-pv01 /mnt/disks/local-pv01 none bind 0 0" >> /etc/fstab ``` +### Deploy local-static-provisioner + After mounting all data disks on Kubernetes nodes, you can deploy [local-volume-provisioner](https://github.com/kubernetes-sigs/sig-storage-local-static-provisioner) to automatically provision the mounted disks as Local PersistentVolumes. ```shell @@ -106,6 +115,20 @@ $ kubectl get po -n kube-system -l app=local-volume-provisioner $ kubectl get pv | grep local-storage ``` +### Remove a mount point + +If we want to remove a mount point, first we need to `umount` the mount point, and then delete the related directories. For example: + +```shell +$ umount /mnt/disks/local-pv01 +$ rm -rf /mnt/disks/local-pv01 +$ rm -rf /data/local-pv01 +``` + +You should also delete the related entries in `/etc/fstab` at the same time, otherwise the automount may cause problems when the machine restarts. + +> Note: The local-volume plugin expects paths to be stable, if you remove a previous mount-point in the discovery directory (default to `/mnt/disks/`), you should remove the PV manually to keep consistency. + ## Install TiDB Operator TiDB Operator uses [CRD](https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/) to extend Kubernetes, so to use TiDB Operator, you should first create `TidbCluster` custom resource kind. This is a one-time job, namely you can only need to do this once in your Kubernetes cluster.