데이터 손실 없이 RedHat VM에서 파티션 확장

데이터 손실 없이 RedHat VM에서 파티션 확장

Veeam의 백업 저장소로 사용하는 RHEL이 포함된 가상 머신이 있습니다. 이제 백업을 위해 파티션을 확장해야 합니다.

  • 원본 크기는 17TB입니다.
  • VMware의 HDD를 19TB(VMware의 두 번째 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

관련 정보