Docker容器扩容
1.查看容器硬盘信息
dmsetup table /dev/mapper/docker-253:2-12884901952-b0bb11eebeb997e2abdcc50caaffe8bbe07d67544e150954d6830344affa5dac
2.输出值
echo $((20*1024*1024*1024/512))
3.echo上面所获得的值,更改原10G扩容到20G
echo 0 41943040 thin 253:3 645 | dmsetup load /dev/mapper/docker-253:2-12884901952-b0bb11eebeb997e2abdcc50caaffe8bbe07d67544e150954d6830344affa5dac
4.激活硬盘
dmsetup resume docker-253:2-12884901952-b0bb11eebeb997e2abdcc50caaffe8bbe07d67544e150954d6830344affa5dac
5.调整文件系统的大小(xfs硬盘类型)
xfs_growfs /dev/mapper/docker-253:2-12884901952-b0bb11eebeb997e2abdcc50caaffe8bbe07d67544e150954d6830344affa5dac
6.重启docker容器
docker stop docker-project
docker start docker-project
(如果启动时报错,则继续执行下列语句)
- 6.1、echo 0 41943040 thin 253:3 645 | dmsetup load /dev/mapper/docker-253:2-12884901952-b0bb11eebeb997e2abdcc50caaffe8bbe07d67544e150954d6830344affa5dac
- 6.2、dmsetup resume docker-253:2-12884901952-b0bb11eebeb997e2abdcc50caaffe8bbe07d67544e150954d6830344affa5dac