kvm虚拟机centos8磁盘扩容

34 篇文章 2 订阅

通过PVE搭建虚拟机,系统盘只有30G,发现使用的时候已经不足,需要进行扩容,

虚拟机关机状态,在PVE增加磁盘大小之后,虚机开机之后,还需要在虚拟机里面进行扩容操作

 

 开机检查磁盘大小

lsblk

[root@localhost ~]# fdisk -l
Disk /dev/vda: 132 GiB, 141733920768 bytes, 276824064 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: dos
Disk identifier: 0x79cee493

Device     Boot   Start      End  Sectors Size Id Type
/dev/vda1  *       2048  2099199  2097152   1G 83 Linux
/dev/vda2       2099200 67108863 65009664  31G 8e Linux LVM


Disk /dev/mapper/cs-root: 29 GiB, 31079792640 bytes, 60702720 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


Disk /dev/mapper/cs-swap: 2.1 GiB, 2202009600 bytes, 4300800 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

开始扩容

1.创建一个新的分区

依次输入以下指令

n    [添加分区]
p    [主分区]
3    [分区号,回车默认也是3]
默认    [直接回车]
默认    [直接回车]
w    [保存分区]
[root@localhost ~]# fdisk /dev/vda

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): n
Partition type
   p   primary (2 primary, 0 extended, 2 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (3,4, default 3): 
First sector (67108864-276824063, default 67108864): 
Last sector, +sectors or +size{K,M,G,T,P} (67108864-276824063, default 276824063): 

Created a new partition 3 of type 'Linux' and of size 100 GiB.

Command (m for help): w
The partition table has been altered.
Syncing disks.

 可以看到新的分区已经出现了

 2.将vda3分区初始化为物理卷

partprobe
pvcreate /dev/vda3

 3.查看跟分区所在的卷组信息

vgdisplay
# vgs

 

 4.扩容cs卷组

vgextend cs /dev/vda3

 5.扩容文件系统

lvextend -l +100%FREE /dev/mapper/cs-root

[root@localhost ~]# pvdisplay 
  --- Physical volume ---
  PV Name               /dev/vda2
  VG Name               cs
  PV Size               <31.00 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              7935
  Free PE               0
  Allocated PE          7935
  PV UUID               Oaojfu-XAyd-ick0-U7nZ-2YFt-VBUk-FGgStv
   
  --- Physical volume ---
  PV Name               /dev/vda3
  VG Name               cs
  PV Size               100.00 GiB / not usable 4.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              25599
  Free PE               0
  Allocated PE          25599
  PV UUID               597ofc-wiTD-8lM3-h2JL-fXlR-alFZ-f12G2n

6.同步文件系统

xfs_growfs /

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Grafana PVE是指使用Grafana作为Proxmox Virtual Environment(PVE)的监控界面。PVE是一种开源的虚拟化管理平台,而Grafana是一个开源的数据可视化和监控工具。通过整合Grafana和PVE,可以创建一个更炫酷的监控界面,并实现对PVE的监控和可视化展示。这样,用户可以更方便地监控和管理PVE的各项指标和数据。可以按照以下步骤来实现Grafana与PVE的整合: 1. 首先,确保已安装好PVE和Grafana,并将它们配置好。 2. 在PVE中,配置数据源,将PVE的指标数据导入到Grafana中。可以使用InfluxDB作为数据源,通过InfluxDB将PVE的数据导入到Grafana中。 3. 在Grafana中创建仪表盘,并添加相应的面板来展示PVE的监控数据。可以根据需要选择和配置不同的面板,比如图表、表格、仪表盘等。 4. 根据个人喜好和需求,进一步美化和定制Grafana的界面和展示效果,比如添加主题、调整布局、添加警报等。 通过以上步骤,就可以打造一个炫酷的PVE监控界面,使用Grafana来实时监控和展示PVE的各项指标和数据。这样,用户可以更方便地了解PVE的状态和性能,并及时采取相应的管理和优化措施。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [宝藏盒PVE Grafana监控模板](https://download.csdn.net/download/lx20220206/87212967)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [打造炫酷的Proxmox VE 监控界面](https://blog.csdn.net/solore/article/details/119720292)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值