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

news/2024/9/23 10:25:13/

我的希望将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                  Flags1      1049kB  211MB   210MB   fat16        EFI System Partition  boot2      211MB   1285MB  1074MB  xfs3      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                  Flags1      1049kB  211MB   210MB   fat16        EFI System Partition  boot2      211MB   1285MB  1074MB  xfs3      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步

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

在这里插入图片描述


http://www.ppmy.cn/news/1501230.html

相关文章

【c++刷题笔记-单调栈】day49: 42. 接雨水 、84.柱状图中最大的矩形

42. 接雨水 - 力扣(LeetCode) 思路:单调栈,第一个是比栈顶大的是右边界,栈顶元素是底,出栈后下一个栈顶元素是左边界。 使用左右边界最小值与中间元素相减算出高度,右边界减左边界减1算出宽度…

C#初级——条件判断语句、循环语句和运算符

条件判断语句 简单的条件判断语句&#xff0c;if()里面进行条件判断&#xff0c;如果条件判断正确就执行语句块1&#xff0c;如果不符合就执行语句块2。 if (条件判断) { 语句块1 } else { 语句块2 } int age 18;if (age < 18){Console.WriteLine("未…

C# 代理模式

栏目总目录 概念 代理模式是一种结构型设计模式&#xff0c;它为其他对象提供一种代理以控制对这个对象的访问。在代理模式中&#xff0c;我们创建一个具有现有对象&#xff08;称为“真实对象”或“被代理对象”&#xff09;相同功能的代理对象。代理对象可以在客户端和目标对…

windows下实现mongodb备份还原

添加环境变量 把mongodb安装目录下的bin路径添加到环境变量的path路径: 备份库 打开CMD&#xff0c;执行以下命令&#xff1a; mongodump -u test -p test -d test -o D://backup_mongodb//20220706 –gzip 参数说明&#xff1a; -u 用户名 -p 密码 -d 需要备份的库名称…

FPGA开发——偶数分频器的设计

一、概述 1、我们在日常进行FPGA的开发之中&#xff0c;会根据需求的不同设计不同的功能实现&#xff0c;这就需要不同的分频信号&#xff0c;而分频的思想在我们的日常开发中显得尤为重要。用通俗易懂的说法表示分频就是对计数器进行一个进一步设计从而达到不同的分频器的思想…

景区AR导航营销系统:技术解决方案与实施效益分析

随着旅游市场的竞争日益激烈&#xff0c;景区需要不断创新以吸引游客。景区 AR 导航将虚拟画面与现实场景相结合&#xff0c;为游客提供了更加直观、生动的导航服务。对于景区而言&#xff0c;这一创新技术无疑是吸引游客目光、提升景区知名度的有力武器。通过独特的 AR 导航体…

【前端 11】初探DOM

JavaScript 对象 - DOM 初探 在Web开发中&#xff0c;DOM&#xff08;Document Object Model&#xff0c;文档对象模型&#xff09;是一个至关重要的概念。它不仅仅是一个API&#xff0c;更是Web页面与JavaScript代码之间的桥梁&#xff0c;允许开发者通过编程的方式动态地访问…

谷粒商城实战笔记-72-商品服务-API-属性分组-获取分类属性分组

文章目录 一&#xff0c;后端接口开发Controller层修改接口接口测试 二&#xff0c;前端开发 这一节的内容是开发获取分类属性分组的接口。 一&#xff0c;后端接口开发 Controller层修改接口 修改AttrGroupController接口。 RequestMapping("/list/{catelogId}")p…