为虚拟机添加新的硬盘并创建LVM

本文介绍如何为Linux虚拟机增加硬盘空间并创建LVM,以解决40G硬盘容量不足的问题。详细步骤包括添加硬盘、创建物理卷、将其加入卷组以及建立LVM并挂载到/opt目录。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

现在使用中的VM只有40G的硬盘,需要再添加一块硬盘并创建LVM挂载到/opt下:

1. 添加硬盘

2. 创建PV

3. 添加PV到VG中

4.创建LVM并挂载


1. 增加硬盘

增加前:

[root@controller3 ~]# fdisk -l

<strong>Disk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 sectors</strong>
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 label type: dos
Disk identifier: 0x0004e5e5

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    83886079    41430016   8e  Linux LVM

Disk /dev/mapper/rhel-swap: 4294 MB, 4294967296 bytes, 8388608 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/rhel-root: 38.1 GB, 38084280320 bytes, 74383360 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

增加后:

[root@controller3 ~]# fdisk -l

<strong>Disk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 sectors</strong>
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 label type: dos
Disk identifier: 0x0004e5e5

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    83886079    41430016   8e  Linux LVM

<strong>Disk /dev/sdb: 32.2 GB, 32212254720 bytes, 62914560 sectors</strong>
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/rhel-swap: 4294 MB, 4294967296 bytes, 8388608 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/rhel-root: 38.1 GB, 38084280320 bytes, 74383360 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (mini
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值