搞了个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
完成!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。