一、基础环境及目标概述
1.查看基础环境
[root@node3 ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs tmpfs 3.9G 388M 3.5G 10% /run
tmpfs tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 92G 2.0G 90G 3% /
/dev/sr0 iso9660 4.4G 4.4G 0 100% /opt
/dev/sda1 xfs 1014M 150M 865M 15% /boot
tmpfs tmpfs 781M 0 781M 0% /run/user/0
/dev/sdb1 xfs 20G 20G 2.0M 100% /data
[root@node3 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 99G 0 part
├─centos-root 253:0 0 91.1G 0 lvm /
└─centos-swap 253:1 0 7.9G 0 lvm [SWAP]
sdb 8:16 0 20G 0 disk
└─sdb1 8:17 0 20G 0 part /data
sr0 11:0 1 4.4G 0 rom /opt
查看基础环境已知:/dev/sdb1挂载至主机/data路径下,sdb硬盘容量为20G,/data文件系统格式为xfs
二、通过vsphere环境扩容sdb物理分区,扩容sdb1物理分区
2.1通过vsphere环境扩容sdb容量至50G(热扩容需重启机器)
本文采用热扩容,经实测热添加扫盘后,sdb磁盘容量未改变;主机重启后,sdb磁盘物理磁盘容量加载成功
[root@node3 ~]# reboot
[root@node3 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 99G 0 part
├─centos-root 253:0 0 91.1G 0 lvm /
└─centos-swap 253:1 0 7.9G 0 lvm [SWAP]
sdb 8:16 0 50G 0 disk
└─sdb1 8:17 0 20G 0 part /data
sr0 11:0 1 4.4G 0 rom /opt
2.2安装growpart命令
内网环境:(手动上传对应版本cloud-utils-cloud-utils-growpart包)
[root@node3 huahui]# ls
cloud-utils-growpart-0.29-5.el7.noarch.rpm
[root@node3 huahui]# rpm -ivh cloud-utils-growpart-0.29-5.el7.noarch.rpm
warning: cloud-utils-growpart-0.29-5.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:cloud-utils-growpart-0.29-5.el7 ################################# [100%]
You have new mail in /var/spool/mail/root
[root@node3 huahui]#
在线环境:
[root@node3 huahui]# yum install -y cloud-utils-growpart
2.3 扩容sdb1物理分区至50G
[root@node3 ~]# growpart /dev/sdb 1
CHANGED: partition=1 start=2048 old: size=41940992 end=41943040 new: size=104855519 end=104857567
You have new mail in /var/spool/mail/root
[root@node3 ~]# lsblk /dev/sdb1
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb1 8:17 0 50G 0 part /data
You have new mail in /var/spool/mail/root
三、扩容/data文件系统
[root@node3 ~]# df -Th /data/ #文件系统类型为xfs
Filesystem Type Size Used Avail Use% Mounted on
/dev/sdb1 xfs 20G 20G 2.0M 100% /data
[root@node3 ~]# partprobe
[root@node3 ~]# xfs_growfs /dev/sdb1
meta-data=/dev/sdb1 isize=512 agcount=4, agsize=1310656 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=5242624, 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 5242624 to 13106939
You have new mail in /var/spool/mail/root
[root@node3 ~]# df -Th /data/
Filesystem Type Size Used Avail Use% Mounted on
/dev/sdb1 xfs 50G 20G 31G 40% /data
四、其他补充
linux中对标准分区(part分区)进行扩容(不需格式化)的方法_liunx part 扩展-CSDN博客
ext4和xfs文件系统的扩容和收缩 - Praywu - 博客园 (cnblogs.com)
标签:vsphere,root,sdb1,文件系统,dev,Linux,node3,data,xfs From: https://blog.51cto.com/u_16502466/12014973