
VM이 포함된 oVirt 서버가 있는데 VM은 20GB 디스크로 생성되었지만 공간이 빨리 부족하여 20GB를 추가하고 이제 디스크를 확장하려고 합니다.
이전 VM에서 이 작업을 한 번 수행한 후 다음 명령을 실행했습니다.
$ sudo lvm
lvm> lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
Size of logical volume ubuntu-vg/ubuntu-lv changed from 4.00 GiB (1024 extents) to <49.00 GiB (12543 extents).
Logical volume ubuntu-vg/ubuntu-lv successfully resized.
lvm> exit
Exiting.
$ sudo lvm
lvm> lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
Size of logical volume ubuntu-vg/ubuntu-lv changed from 4.00 GiB (1024 extents) to <49.00 GiB (12543 extents).
Logical volume ubuntu-vg/ubuntu-lv successfully resized.
lvm> exit
Exiting.
$ sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required old_desc_blocks = 1, new_desc_blocks = 7
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 12844032 (4k) blocks long.
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 949M 0 949M 0% /dev
tmpfs 199M 1.2M 198M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 49G 3.8G 43G 9% /
tmpfs 993M 0 993M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 993M 0 993M 0% /sys/fs/cgroup
/dev/sda2 976M 107M 803M 12% /boot
/dev/loop0 28M 28M 0 100% /snap/snapd/7264
/dev/loop1 55M 55M 0 100% /snap/core18/1705
/dev/loop2 69M 69M 0 100% /snap/lxd/14804
/dev/loop3 33M 33M 0 100% /snap/snapd/12159
/dev/loop4 56M 56M 0 100% /snap/core18/2074
/dev/loop5 62M 62M 0 100% /snap/core20/1026
/dev/loop6 67M 67M 0 100% /snap/lxd/20840
tmpfs 199M 0 199M 0% /run/user/1000
그리고 디스크가 확장되었지만 이제 어떤 이유로 새 VM에서 이러한 명령이 작동하지 않고 다음과 같은 출력이 표시됩니다.
$ sudo lvm
lvm> lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
New size (4863 extents) matches existing size (4863 extents).
lvm>
$ sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs 1.45.5 (07-Jan-2020)
The filesystem is already 4979712 (4k) blocks long. Nothing to do!
살펴보면 fdisk -l
다음과 같은 내용이 있습니다.
Disk /dev/loop0: 54.97 MiB, 57614336 bytes, 112528 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/loop1: 55.45 MiB, 58134528 bytes, 113544 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/loop2: 61.79 MiB, 64770048 bytes, 126504 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/loop3: 68.26 MiB, 71573504 bytes, 139792 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/loop4: 68.17 MiB, 71475200 bytes, 139600 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/loop5: 27.9 MiB, 28405760 bytes, 55480 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/loop6: 32.3 MiB, 33865728 bytes, 66144 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/sda: 40 GiB, 42949672960 bytes, 83886080 sectors
Disk model: QEMU HARDDISK
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: EFA99D35-85DD-4D0D-A4DE-19514BF6AE89
Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 2101247 2097152 1G Linux filesystem
/dev/sda3 2101248 41940991 39839744 19G Linux filesystem
Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 18.102 GiB, 20396900352 bytes, 39837696 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
아직 디스크 파티션을 확장하지 않았습니다. 이것이첫 번째단계를 건너뛰려고 하는데 어떤 이유로든 이 단계(및 또 다른 필수 단계)를 건너뛰려고 합니다.
Device Start End Sectors Size Type
/dev/sda3 2101248 41940991 39839744 19G Linux filesystem
도구를 사용하여 growpart
파티션 확장안전하게. 블록 장치와 파티션 번호를 별도의 인수로 사용한다는 점을 기억하세요.
sudo growpart /dev/sda 3
아직 설치하지 않았다면 설치하세요.
이 작업이 완료되면 PV 크기 조정과 LV 크기 조정으로 이동할 수 있습니다.
sudo pvresize /dev/sda3
... the rest of what you were trying to do.