跳到主要内容

lvm

lvm

centos7扩容/目录

汇总命令:

lsblk;df -hT

pvcreate /dev/sdb
vgextend centos /dev/sdb
lvextend -L +19G /dev/centos/root
xfs_growfs /dev/centos/root

lsblk;df -hT

扩容过程:

[root@devops8 k8s]#df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 17G 8.2G 8.8G 49% /
devtmpfs devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs tmpfs 7.8G 12M 7.8G 1% /run
tmpfs tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/sda1 xfs 1014M 146M 869M 15% /boot
tmpfs tmpfs 1.6G 0 1.6G 0% /run/user/0
overlay overlay 17G 8.2G 8.8G 49% /var/lib/docker/overlay2/800c273181c01ff9dfac4031c57d3403244958b85fad5737db77a4a1a906f875/merged
overlay overlay 17G 8.2G 8.8G 49% /var/lib/docker/overlay2/e7f299bd0d54fa558793cfb0e785a84c7e70a77cafda0ef51af987b78275c7c4/merged
overlay overlay 17G 8.2G 8.8G 49% /var/lib/docker/overlay2/3c36a8b71024089abf15e2d2cd1c0ed844b9c33138fb3202589002aae3254f93/merged
[root@devops8 k8s]#lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 20G 0 disk
sr0 11:0 1 1024M 0 rom


[root@devops8 k8s]#pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created.
[root@devops8 k8s]#vgextend centos /dev/sdb
Volume group "centos" successfully extended
[root@devops8 k8s]#lvextend -L +19G /dev/centos/root
Size of logical volume centos/root changed from <17.00 GiB (4351 extents) to <36.00 GiB (9215 extents).
Logical volume centos/root successfully resized.
[root@devops8 k8s]#xfs_growfs /dev/centos/root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=1113856 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=4455424, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 4455424 to 9436160
[root@devops8 k8s]#df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 36G 8.2G 28G 23% /
devtmpfs devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs tmpfs 7.8G 12M 7.8G 1% /run
tmpfs tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/sda1 xfs 1014M 146M 869M 15% /boot
tmpfs tmpfs 1.6G 0 1.6G 0% /run/user/0
overlay overlay 36G 8.2G 28G 23% /var/lib/docker/overlay2/800c273181c01ff9dfac4031c57d3403244958b85fad5737db77a4a1a906f875/merged
overlay overlay 36G 8.2G 28G 23% /var/lib/docker/overlay2/e7f299bd0d54fa558793cfb0e785a84c7e70a77cafda0ef51af987b78275c7c4/merged
overlay overlay 36G 8.2G 28G 23% /var/lib/docker/overlay2/3c36a8b71024089abf15e2d2cd1c0ed844b9c33138fb3202589002aae3254f93/merged
[root@devops8 k8s]#