ESXI虚拟机磁盘在线扩容
合集下载
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
2
Open LV
2
Max PV
0
Cur PV
2
Act PV
2
VG Size
98.99 GiB
PE Size
4.00 MiB
Total PE
25342
Alloc PE / Size 3839 / <15.00 GiB
Free PE / Size 21503 / <84.00 GiB
VG UUID
Dw2t3d-lOmX-GwB8-r7z2-X2S2-2vzf-gn1ncn
3839
Alloc PE / Size 3839 / <15.00 GiB
Free PE / Size 0 / 0
VG UUID
Dw2t3d-lOmX-GwB8-r7z2-X2S2-2vzf-gn1ncn
lvm> vgextend centos /dev/sda3 Volume group "centos" successfully extended
使用命令重新读取分区表,或者重启机器 # partprobe Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.
格式化新磁盘分区
xfs文件系统 # mkfs.xfs /dev/sda3 EXT4文件系统 # mkfs.ext4 /dev/sda3
lvm> quit
3. 文件系统扩容
xfs文件系统
[root@jason_test ~]# xfs_growfs /dev/mapper/centos-root meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=877824 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0 spinodes=0 data = bsize=4096 blocks=3511296, 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 3511296 to 25530368
fdiskdevsdan新建分区p选择分区类型主分区或扩展分区3选择分区编号回车回车t修改分区类型3选择分区8echangedtypeofpartitionlinuxtolinuxlvm修改成lvm类型w写分区表退出
ESXI虚 拟 机 磁 盘 在 线 扩 容
1、VMware修改硬盘大小
关闭客户机 右键需要扩容的服务器——设置——硬件——磁盘——实用工具——扩展
(此处分区格式要与已有的LVM卷中分区格式一致)
查看分区格式 cat /etc/fstab
2. 添加新 LVM分区到已有的 LVM组,实现扩容
[root@jason_test ~]# lvm
lvm> pvcreate /dev/sda3
WARNING: ext4 signature detected on /dev/sda3 at offset 1080. Wipe it? [y/n]: y
EXT4文件系统
resize2fs /dev/mapper/centos-root
[root@jason_test ~]# df -h
Filesystem
Size Used Avail Use% Mounted on
/dev/mapper/centos-root 98G 11G 87G 11% /
devtmpfs
lvm> vgdisplay --- Volume group ---
VG Name
centos
System ID
Format
lvm2
Metadata Areas
2
Metadata Sequence No 4
VG Access
read/write
VG Status
resizable
MAX LV
0
Cur LV
Logical volume centos/root successfully resized.
lvm> pvdisplay
--- Physical volume ---
PV Name
/dev/sda2
VG Name
centos
PV Size
<15.00 GiB / not usable 3.00 MiB
7.8G 0 7.8G 0% /dev
tmpfs
7.8G 0 7.8G 0% /dev/shm
tmpfs
7.8G 9.3M 7.8G 1% /run
tmpfs
7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/sda1
1014M 182M 833M 18% /boot
tmpfs
1.6G 0 1.6G 0% /run/user/0
Allocatable
yes (but full)
PE Size
4.00 MiB
Total PE
3839
Free PE
0
Allocated PE
3839
PV UUID
0khpbf-D1I8-hdt0-U78f-ELax-V2xR-eOL8g9
--- Physical volume ---
PV Name
Wiping ext4 signature on /dev/sda3.
Physical volume "/dev/sda3" successfully created.
lvm> vgdisplay
--- Volume group ---
VG Name
centos
System ID
Format
lvm2
2、确认状态 # fdisk -l
可以看到“Disk /dev/sda: 400 GB”,已经扩展了300G空间。
ESXI修改完磁盘大小后,增加的磁盘空间表现为当前磁盘剩余未分配空间,需要使用剩余未分配空间新建分区
1. 创建新分区
# fdisk /dev/sda n (新建分区) p (选择分区类型主分区或扩展分区) 3 (选择分区编号) 回车 回车 t (修改分区类型) 3 (选择分区) 8e (Changed type of partition 'Linux' to 'Linux LVM',修改成LVM类型) w (写分区表退出)
/dev/sda3
VG Name
centos
PV Size
84.00 GiB / not usable 4.00 MiB
Allocatable
yes (but full)
PE Size
4.00 MiB
Total PE
21503
Free PE
0
Allocated PE
21503
PV UUID
lCHa3l-XXpa-B1OY-6gEq-CBAl-2NxS-CzrCn2
lvm> lvextend -l +21503 /dev/mapper/centos-root (想要扩容的分区)
Size of logical volume centos/root changed from 13.39 GiB (3429 extents) to 97.39 GiB (24932 extents).
Mnce No 3
VG Access
read/write
VG Status
resizable
MAX LV
0
Cur LV
2
Open LV
2
Max PV
0
Cur PV
1
Act PV
1
VG Size
<15.00 GiB
PE Size
4.00 MiB
Total PE