I have a VM on Promox running Debian 11. I need to increase disk space, so I've resized disk in Proxmox GUI. But now, I need to enlarge root partition. This wouldn't be a problem, if root partition was the last on disk, but now, it's a partition in the middle of the disk. There is a swap partition that needs to be moved to the end of the disk, before I can resize the root partition. But there are two conditions to be fulfilled:
- The swap partition has to keep the same size
- The final swap partition has to be aligned properly to disk layout
As I'm working on a headless, we have to use CLI. This is, what parted give me:
(parted) print
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 68.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 2097kB 1049kB bios_grub
2 2097kB 33.3GB 33.3GB ext4
3 33.3GB 34.4GB 1022MB linux-swap(v1) swap
(parted) print free
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 68.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
17.4kB 1049kB 1031kB Free Space
1 1049kB 2097kB 1049kB bios_grub
2 2097kB 33.3GB 33.3GB ext4
3 33.3GB 34.4GB 1022MB linux-swap(v1) swap
34.4GB 68.7GB 34.4GB Free Space
I know, that I have to remove the existing swap partition, using swapoff /dev/sda3
and deleting it in parted.
My question is: What do I have to type in for creating a properly aligned swap partition with exactly the same size at the end of this disk?
BTW: I don't want top replace Swap with a file.