在 RedHat VM 上扩展分区而不丢失数据

在 RedHat VM 上扩展分区而不丢失数据

我有一个带有 RHEL 的虚拟机,用作 Veeam 的备份存储库。现在我需要扩展分区进行备份。

  • 原始大小为 17TB
  • 我将VMware中的HDD扩展至19TB(这是VMware中的第二个HDD),然后重新启动了VM。
  • 重新启动后,在fdisk -l输出中我看到一些有关 19TB 虚拟磁盘的信息,但备份路径仍然是 17 TB -/backup(/dev/mapper/vg02-backup)

输出fdisk -l如下:

[root@bckrepo01 ~]# fdisk -l
Disk /dev/sda: 60 GiB, 64424509440 bytes, 125829120 sectors
Disk model: Virtual disk
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: 08B39BDB-49C7-4B76-BC5D-1BDCD5AA1DE5

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 108201983 104873984   50G Linux LVM
The backup GPT table is not on the end of the device.


Disk /dev/sdb: 19 TiB, 20890720927744 bytes, 40802189312 sectors
Disk model: Virtual disk
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: 952E38DA-AC78-DD44-AF19-B31C2FD62B00

Device           Start         End     Sectors Size Type
/dev/sdb1         2048 27917287390 27917285343  13T Linux filesystem
/dev/sdb2  27917287424 36507221982  8589934559   4T Linux filesystem


Disk /dev/mapper/vg01-root: 4 GiB, 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/vg01-swap: 8 GiB, 8589934592 bytes, 16777216 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/vg01-usr: 8 GiB, 8589934592 bytes, 16777216 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/vg02-backup: 17 TiB, 18691689283584 bytes, 36507205632 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/vg01-tmp: 4 GiB, 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/vg01-home: 2 GiB, 2147483648 bytes, 4194304 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/vg01-var: 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


Disk /dev/mapper/vg01-opt: 8 GiB, 8589934592 bytes, 16777216 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@bckrepo01 ~]#

输出如下

 [root@bckrepo01 ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               vg02
  PV Size               <13.00 TiB / not usable 2.98 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              3407871
  Free PE               0
  Allocated PE          3407871
  PV UUID               lVTuSm-GUEJ-re6D-wWWl-BOTB-tGJt-15WSXR

  --- Physical volume ---
  PV Name               /dev/sdb2
  VG Name               vg02
  PV Size               <4.00 TiB / not usable 3.98 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              1048575
  Free PE               0
  Allocated PE          1048575
  PV UUID               Xd3k9k-PHj1-3lKY-jS3W-JLPB-kP1E-QeTrl2

  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               vg01
  PV Size               <50.01 GiB / not usable 4.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              12801
  Free PE               1
  Allocated PE          12800
  PV UUID               2EnuN5-5FTY-02iZ-O8w8-G5WS-kkng-3wv5i9

谢谢你的帮助

答案1

安装该growpart实用程序(包名称可能cloud-utils-growpart在某些发行版中),然后运行:

sudo growpart /dev/sdb 2 #yes, with the space
sudo pvresize /dev/sdb2

然后新容量将像往常一样在 LVM 中可用。要将其全部添加到您的备份 LV:

sudo lvextend -l +100%FREE -r /dev/mapper/vg02-backup

相关内容