How to Safely Unmount the Data Disk of TiKV

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 如何安全的umount掉tikv的数据盘

| username: edmund_luo

【TiDB Usage Environment】
【TiDB Version】
【Reproduction Path】
Directly perform the umount -f {mountpoint} operation on the mount point of the tikv disk
【Encountered Problem: Problem Phenomenon and Impact】
Returns target busy exception message.
The disk can be unmounted using umount -l, but this method is not very controllable.
【Resource Configuration】
【Attachments: Screenshots/Logs/Monitoring】

| username: forever | Original post link

What are the specific requirements?

| username: zhanggame1 | Original post link

Is the TiKV service turned off?

| username: 小龙虾爱大龙虾 | Original post link

If the disk is not being used by various components of the TiDB cluster, you can unmount it. If it is in use, scale down first.

| username: 普罗米修斯 | Original post link

If you need to use it again, you need to scale down and then unmount.

| username: 江湖故人 | Original post link

TiKV needs to scale in first and confirm successful offline status before safely unmounting. The steps are as follows:

tiup cluster scale-in <cluster-name> --node

Here, the --node parameter is the ID of the node to be taken offline. The expected output is Scaled cluster <cluster-name> in successfully, indicating that the scale-in operation was successful.

Taking a node offline takes some time. When the status of the offline node changes to Tombstone, it means the node has been successfully taken offline. Execute the following command to check if the node has been successfully taken offline:

tiup cluster display <cluster-name>
| username: dba远航 | Original post link

Stop the service first before proceeding.

| username: tidb菜鸟一只 | Original post link

First, use lsof to check which process is still using the corresponding directory…

| username: xingzhenxiang | Original post link

First scale down, then scale back up.

| username: WinterLiu | Original post link

It shouldn’t be difficult. After scaling down offline, you can normally unmount.

| username: 哈喽沃德 | Original post link

The one currently in use definitely won’t work.

| username: TiDBer_小阿飞 | Original post link

First, confirm the data size and whether the remaining TiKV nodes are sufficient. If they are sufficient, first take the TiKV node that needs to be unmounted offline. After all the data has been transferred to the active TiKV nodes and the status is Tombstone, then delete the node using the command:
tiup cluster scale-in --node

| username: 这里介绍不了我 | Original post link

You need to first expand the node, then shrink it, wait for its status to be tomestore, and then proceed with disk unloading.