十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
搞了个centos7.5安装12.2rac,安装数据库软件时空间不够,所以打算扩一下lvm。
操作系统版本:
[root@mdb1 ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.5.1804 (Core)
Release: 7.5.1804
Codename: Core
sdb盘初始化为物理卷
[root@mdb1 ~]#
pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created.
将要添加的物理卷加入到vg卷组中
[root@mdb1 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 1 0 wz--n- 21.53g 0
[root@mdb1 ~]#
vgextend centos /dev/sdb
Volume group "centos" successfully extended
[root@mdb1 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 2 1 0 wz--n- <29.53g <8.00g
扩展lvm
[root@mdb1 ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root centos -wi-ao---- 21.53g
[root@mdb1 ~]#
lvextend -l +100%FREE /dev/mapper/centos-root
Size of logical volume centos/root changed from 21.53 GiB (5512 extents) to <29.53 GiB (7559 extents).
Logical volume centos/root successfully resized.
此时卷组还没扩展,需要resize一下
[root@mdb1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 22G 14G 7.6G 65% /
devtmpfs 1.4G 0 1.4G 0% /dev
tmpfs 1.4G 0 1.4G 0% /dev/shm
tmpfs 1.4G 9.6M 1.4G 1% /run
tmpfs 1.4G 0 1.4G 0% /sys/fs/cgroup
/dev/sda1 473M 134M 339M 29% /boot
tmpfs 279M 0 279M 0% /run/user/0
tmpfs 279M 0 279M 0% /run/user/1001
[root@mdb1 ~]#
resize2fs /dev/mapper/centos-root
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/mapper/centos-root
Couldn't find valid filesystem superblock.
linux从7开始默认文件系统放弃了第四代ext4的文件系统,转向了xfs日志文件系统。该系统性能比ext4增强很多,扩展性也更强,能够得到近似裸设备的IO性能。该文件系统下的lvm拉伸命令也有了变化,需要xfs_growfs实现之前的resize2fs命令的功能。
[root@mdb1 ~]#
xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=1411072 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=5644288, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=2756, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 5644288 to 7740416
[root@mdb1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 30G 14G 16G 48% /
devtmpfs 1.4G 0 1.4G 0% /dev
tmpfs 1.4G 644M 747M 47% /dev/shm
tmpfs 1.4G 9.6M 1.4G 1% /run
tmpfs 1.4G 0 1.4G 0% /sys/fs/cgroup
/dev/sda1 473M 134M 339M 29% /boot
tmpfs 279M 0 279M 0% /run/user/0
完成!
成都创新互联是一家以重庆网站建设公司、网页设计、品牌设计、软件运维、成都网站推广、小程序App开发等移动开发为一体互联网公司。已累计为办公窗帘等众行业中小客户提供优质的互联网建站和软件开发服务。