今天在给测试环境搭建k8s系统时,发现master根目录磁盘空间不足,需要扩容,记录如下。
# 查看根分区大小 [[email protected] ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 63G 0 63G 0% /dev tmpfs 63G 0 63G 0% /dev/shm tmpfs 63G 1.3G 62G 2% /run tmpfs 63G 0 63G 0% /sys/fs/cgroup /dev/mapper/cl_geekthings-root 50G 38G 13G 76% / /dev/sda1 1014M 311M 704M 31% /boot /dev/mapper/cl_geekthings-home 918G 12G 906G 2% /home tmpfs 13G 12K 13G 1% /run/user/42 tmpfs 13G 0 13G 0% /run/user/0 overlay 50G 38G 13G 76% /var/lib/docker/overlay2/70dffe831895bb55d79b4a8f483364a4f736637ccb2f6694f1cf82ba7ff1743d/merged # 查看磁盘编号 [[email protected] ~]# ls /dev/sd* /dev/sda /dev/sda1 /dev/sda2 # 这里在vMware vCenter中新增一块硬盘(编辑->新增设备) 再次查看磁盘 [[email protected] ~]# ls /dev/sd* /dev/sda /dev/sda1 /dev/sda2 /dev/sdb # 创建pv [[email protected] ~]# pvcreate /dev/sdb Physical volume "/dev/sdb" successfully created. # 查看vg组 [[email protected] ~]# vgs VG #PV #LV #SN Attr VSize VFree cl_geekthings 1 3 0 wz--n- <999.00g 4.00m # 扩展vg [[email protected] ~]# vgextend cl_geekthings /dev/sdb Volume group "cl_geekthings" successfully extended [[email protected] ~]# vgs VG #PV #LV #SN Attr VSize VFree cl_geekthings 2 3 0 wz--n- 1.17t 200.00g # 扩展lv [[email protected] ~]# lvextend -L +200G /dev/mapper/cl_geekthings-root Size of logical volume cl_geekthings/root changed from 50.00 GiB (12800 extents) to 250.00 GiB (64000 extents). Logical volume cl_geekthings/root successfully resized. # 系统重新读取大小 [[email protected] ~]# xfs_growfs /dev/mapper/cl_geekthings-root meta-data=/dev/mapper/cl_geekthings-root isize=512 agcount=4, agsize=3276800 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0 spinodes=0 data = bsize=4096 blocks=13107200, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal bsize=4096 blocks=6400, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 data blocks changed from 13107200 to 65536000 # 查看扩容是否成功 [[email protected] ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 63G 0 63G 0% /dev tmpfs 63G 0 63G 0% /dev/shm tmpfs 63G 1.3G 62G 2% /run tmpfs 63G 0 63G 0% /sys/fs/cgroup /dev/mapper/cl_geekthings-root 250G 38G 213G 16% / /dev/sda1 1014M 311M 704M 31% /boot /dev/mapper/cl_geekthings-home 918G 12G 906G 2% /home tmpfs 13G 12K 13G 1% /run/user/42 tmpfs 13G 0 13G 0% /run/user/0 overlay 250G 38G 213G 16% /var/lib/docker/overlay2/70dffe831895bb55d79b4a8f483364a4f736637ccb2f6694f1cf82ba7ff1743d/merged [[email protected] ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 1000G 0 disk ├─sda1 8:1 0 1G 0 part /boot └─sda2 8:2 0 999G 0 part ├─cl_geekthings-root 253:0 0 250G 0 lvm / ├─cl_geekthings-swap 253:1 0 31.5G 0 lvm └─cl_geekthings-home 253:2 0 917.5G 0 lvm /home sdb 8:16 0 200G 0 disk └─cl_geekthings-root 253:0 0 250G 0 lvm / sr0 11:0 1 4.1G 0 rom
原文地址:https://www.cnblogs.com/herui1991/p/12052967.html
时间: 2024-11-07 12:52:30