PVE环境中调整虚拟机磁盘大小

我的希望将PVE中的虚拟机磁盘调整一下,增加20GB。在查询了一些资料后,做一下总结教程。

环境是 PVE8.2.2 版本,虚拟机系统是centos7.9.2009-minimal, 安装系统时划分磁盘分区方式是默认分区方式(不同分区方式下,扩展磁盘大小的操作步骤可能不相同)。

第1步

先将虚拟机关机状态

第2步

在PVE管理平台,调整虚拟机磁盘大小.

我这里需要添加20GB。

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

第3步

启动虚拟机

第4步

进入虚拟机系统,查看系统的分区信息,磁盘信息。可以发现,磁盘的总大小变了,但是分区没变。所以我们接下来的工作,是调整分区大小。

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

第5步

我希望将将剩余空间加在sda3上。这里可以根据实际需要调整。

[root@localhost ~]# parted /dev/sda
GNU Parted 3.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Error: The backup GPT table is not at the end of the disk, as it should be.  This might mean that another operating system believes the disk is smaller.  Fix, by moving the backup to the end (and removing the old backup)?
Fix/Ignore/Cancel? Fix
Warning: Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all of the space (an extra 41943040 blocks) or continue with the current setting? 
Fix/Ignore? Fix                                                           
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 64.4GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name                  Flags
 1      1049kB  211MB   210MB   fat16        EFI System Partition  boot
 2      211MB   1285MB  1074MB  xfs
 3      1285MB  42.9GB  41.7GB                                     lvm

(parted) resizepart 3 100%
(parted) print
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 64.4GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name                  Flags
 1      1049kB  211MB   210MB   fat16        EFI System Partition  boot
 2      211MB   1285MB  1074MB  xfs
 3      1285MB  64.4GB  63.1GB                                     lvm

(parted) quit                                                             
Information: You may need to update /etc/fstab.

[root@localhost ~]#  

如果出现类似如下的提示:直接输入Fix 修复即可。

Error: The backup GPT table is not at the end of the disk, as it should be.  This might mean that another operating system believes the disk is smaller.  Fix, by moving the backup to the end (and removing the old backup)?
Fix/Ignore/Cancel?

Warning: Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all of the space (an extra 41943040 blocks) or continue with the current setting? 
Fix/Ignore? Fix  

在这里插入图片描述

第6步

更新物理卷 和 逻辑卷大小

[root@localhost ~]# pvresize /dev/sda3
[root@localhost ~]# lvresize --extents +100%FREE --resizefs /dev/mapper/centos-root

# 此处的参数可以根据实际需要调整

在这里插入图片描述

第7步

验证是否生效。通过命令查看,发现已经生效。

在这里插入图片描述

### Proxmox Virtual Environment 下载与安装教程 #### 安装环境准备 为了成功部署 PVE,需确认硬件满足最低配置需求。建议服务器具备至少 2 GB RAM 和双核处理器,同时确保网络连接正常以便下载所需组件[^2]。 #### 获取 ISO 镜像文件 访问官方网址 https://www.proxmox.com/en/downloads 来获取最新版本的 PVE 安装镜像。页面提供了多种不同架构的选择,请依据实际使用的机器类型挑选合适的ISO 文件进行下载。由于官方网站可能加载速度较慢,在国内环境下可以考虑通过其他可信渠道间接获得该资源[^3]。 #### 使用 VMware Workstation 创建新虚拟机 启动 VMware Workstation 后点击创建新的自定义虚拟机选项。选择稍后安装操作系统并指定客户操作系统为 Linux 类型下的 Debian 8.x 或更高版本(取决于所选PVE 版本)。分配足够的硬盘空间给此虚拟机,并设置内存大小不低于推荐值。最后一步是挂载之前下载好的 PVE ISO 映像作为光驱设备完成初始化工作。 #### 开始安装过程 进入 BIOS/UEFI 设置界面调整引导顺序使 CD-ROM 成为首项以允许从安装介质启动。按照屏幕提示逐步操作直至结束整个流程。期间会涉及到一些基本参数设定比如主机名、管理员密码以及目标磁盘分区方案等环节需要注意仔细填写正确无误的信息。 ```bash # 更新软件包列表并升级现有程序至最新版 apt-y ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值