V
V
Vitaly2021-01-19 11:58:18
linux
Vitaly, 2021-01-19 11:58:18

Why partition cannot be grown (growpart)?

Increased disk space for KVM VM via virsh.

lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0     11:0    1 1024M  0 rom
vda    253:0    0  110G  0 disk
├─vda1 253:1    0    8M  0 part
├─vda2 253:2    0   38G  0 part /var
└─vda3 253:3    0    2G  0 part [SWAP]


sudo fdisk -l
Disk /dev/vda: 110 GiB, 118111600640 bytes, 230686720 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
Disklabel type: gpt
Disk identifier: 60406237-6A97-40BB-9E84-FE7E75F6D9CC

Device        Start      End  Sectors Size Type
/dev/vda1      2048    18431    16384   8M BIOS boot
/dev/vda2     18432 79689727 79671296  38G Linux filesystem
/dev/vda3  79689728 83886046  4196319   2G Linux swap


On a virtual machine (openSUSE) I try to increase the /dev/vda2 partition, but I get the following error:
sudo growpart /dev/vda 2
NOCHANGE: partition 2 is size 79671296. it cannot be grown


Why is this happening? Do I need to move /dev/vda3 to the end first, and only then expand /dev/vda2?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2021-01-19
@vitalysokolov

Yes, turn off swap, demolish the corresponding section, and then increase the one in the middle. In general, on a virtual machine, there is not much point in swapping on a separate partition, just think about stuffing it into a file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question