データを失うことなくRedHat VMでパーティションを拡張する

データを失うことなくRedHat VMでパーティションを拡張する

Veeamのバックアップストアとして使用するRHELを含む仮想マシンがあります。これで、バックアップ用にパーティションを拡張する必要があります。

  • 元のサイズは17TBです。
  • VMwareのHDDを19TB(VMwareの2番目のHDD)に拡張し、VMを再起動しました。
  • 再起動後fdisk -l、出力には19TBの仮想ディスクに関するいくつかの情報が表示されますが、バックアップパスはまだ17TBです。/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

関連情報