docker pull mysql 时报错,说空间不足
在docker pull mysql 时报错,说空间不足,结果后来才发现在安装Ubuntu Server的时候采用了LVM,这才导致了根目录只有3.9G。
用指令 df -h 查看磁盘情况
root@mysheep:/var/lib/docker# df -h
Filesystem Size Used Avail Use% Mounted on
udev 955M 0 955M 0% /dev
tmpfs 198M 1.2M 196M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 3.9G 3.5G 237M 94% /
tmpfs 986M 0 986M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 986M 0 986M 0% /sys/fs/cgroup
/dev/loop0 90M 90M 0 100% /snap/core/8039
/dev/loop1 89M 89M 0 100% /snap/core/7270
/dev/sda2 976M 77M 832M 9% /boot
tmpfs 198M 0 198M 0% /run/user/1000
所以现在需要扩容,用指令显示存在的卷组,vgdisplay
root@mysheep:/var/lib/docker# vgdisplay
--- Volume group ---
VG Name ubuntu-vg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size <19.00 GiB
PE Size 4.00 MiB
Total PE 4863
Alloc PE / Size 1024 / 4.00 GiB
Free PE / Size 3839 / <15.00 GiB
VG UUID lhPVeA-sFX5-5sQ6-2mAq-VR41-uvjU-YrPzFI
Free PE / Size 3839 / <15.00 GiB
这是还可以扩充的大小
然后输入指令扩容
lvextend -L 120G /dev/mapper/ubuntu--vg-ubuntu--lv //增大至120G
lvextend -L +20G /dev/mapper/ubuntu--vg-ubuntu--lv //增加20G
lvreduce -L 50G /dev/mapper/ubuntu--vg-ubuntu--lv //减小至50G
lvreduce -L -8G /dev/mapper/ubuntu--vg-ubuntu--lv //减小8G
lvresize -L 30G /dev/mapper/ubuntu--vg-ubuntu--lv //调整为30G
resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv //执行调整
上面时示范,可以根据自身情况来进行扩容,最后执行最后的调整指令,然后就扩充成功了
root@mysheep:/var/lib/docker# df -h
Filesystem Size Used Avail Use% Mounted on
udev 955M 0 955M 0% /dev
tmpfs 198M 1.2M 196M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 9.8G 3.5G 5.9G 37% /
tmpfs 986M 0 986M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 986M 0 986M 0% /sys/fs/cgroup
/dev/loop0 90M 90M 0 100% /snap/core/8039
/dev/loop1 89M 89M 0 100% /snap/core/7270
/dev/sda2 976M 77M 832M 9% /boot
tmpfs 198M 0 198M 0% /run/user/1000
参考:https://blog.csdn.net/Fish_Sheep/article/details/103325378