![如何在不丢失数据的情况下动态扩展 CentOS v8 VM 磁盘空间?](https://linux22.com/image/756090/%E5%A6%82%E4%BD%95%E5%9C%A8%E4%B8%8D%E4%B8%A2%E5%A4%B1%E6%95%B0%E6%8D%AE%E7%9A%84%E6%83%85%E5%86%B5%E4%B8%8B%E5%8A%A8%E6%80%81%E6%89%A9%E5%B1%95%20CentOS%20v8%20VM%20%E7%A3%81%E7%9B%98%E7%A9%BA%E9%97%B4%EF%BC%9F.png)
我需要一些可以从 Putty 会话中遵循的步骤,以便我可以扩展 CentOS v8 VM 而不丢失其数据?
我已经将 VMDK 中的磁盘空间从最初的 40 GB 扩展到 60 GB。
[root@PRDSVR08-VM etc]# fdisk -l /dev/sda
Disk /dev/sda: 16 GiB, 17179869184 bytes, 33554432 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 8FD17E63-2BF2-48B9-BA7A-79D8BEC3F9AF
Device Start End Sectors Size Type
/dev/sda1 2048 1230847 1228800 600M EFI System
/dev/sda2 1230848 3327999 2097152 1G Linux filesystem
/dev/sda3 3328000 33552383 30224384 14.4G Linux LVM
[root@PRDSVR08-VM etc]# sudo fdisk /dev/sda
Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): d
Partition number (1-3, default 3): 3
Partition 3 has been deleted.
Command (m for help): n
Partition number (3-128, default 3): 3
First sector (3328000-33554398, default 3328000):
Last sector, +sectors or +size{K,M,G,T,P} (3328000-33554398, default 33554398):
Created a new partition 3 of type 'Linux filesystem' and of size 14.4 GiB.
Partition #3 contains a LVM2_member signature.
Do you want to remove the signature? [Y]es/[N]o:
Do you want to remove the signature? [Y]es/[N]o: N
Command (m for help): p
Disk /dev/sda: 16 GiB, 17179869184 bytes, 33554432 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 8FD17E63-2BF2-48B9-BA7A-79D8BEC3F9AF
Device Start End Sectors Size Type
/dev/sda1 2048 1230847 1228800 600M EFI System
/dev/sda2 1230848 3327999 2097152 1G Linux filesystem
/dev/sda3 3328000 33554398 30226399 14.4G Linux filesystem
Command (m for help): w
The partition table has been altered.
Syncing disks.
磁盘空间好像还是一样,但是 FS 好像有点不一样?
[root@PRDSVR08-VM etc]# fdisk -l /dev/sda
Disk /dev/sda: 16 GiB, 17179869184 bytes, 33554432 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 8FD17E63-2BF2-48B9-BA7A-79D8BEC3F9AF
Device Start End Sectors Size Type
/dev/sda1 2048 1230847 1228800 600M EFI System
/dev/sda2 1230848 3327999 2097152 1G Linux filesystem
/dev/sda3 3328000 33554398 30226399 14.4G Linux filesystem
[root@PRDSVR08-VM etc]#
如何纠正上述问题?
先感谢您。