准备工作:
0.格式化使用的存储硬盘为ext4(可选步骤)
mkfs.ext4 /dev/sda
df -lh
1.挂载硬盘
mount /dev/sda /mnt/extData
2.停止相关服务:
systemctl daemon-reload
systemctl stop kubelet
systemctl stop docker
3.创建新数据目录
mkdir /mnt/extData/docker
4./var/lib/docker 下的数据搬迁到指定目录:
cp -R /var/lib/docker/* /mnt/extData/docker
5.备份原来数据目录
mv /var/lib/docker /var/lib/docker-bak
6.修改启动脚本
vi /lib/systemd/system/docker.service
ExecStart=
追加–graph=/mnt/extData/docker
7.重新启用服务
systemctl daemon-reload
systemctl restart docker
systemctl start kubelet