shell Debian Resize Partition

// switch the swap off
swapoff -a

// remove all swap/extended partitions
fdisk /dev/sda
    d -> enter -> 5 -> enter
    d -> enter -> 2 -> enter
    w -> enter

// amend the size of the main partition
parted /dev/sda
    print
    resizepart 1 62GB
    q -> enter

// resize the primary partition
resize2fs /dev/sda1

// create a new swap partition
fdisk /dev/sda
    n -> enter// new
    p -> enter// partition
    2 -> enter// partition number
    enter// default
    t -> enter// type
    2 -> enter// partition number
    82 -> enter// linux swap code
    w -> enter// save+exit

// hook up the new swap partition
mkswap /dev/sda2

// turn swap back on
swapon /dev/sda2

// verify it has all worked
lsblk
swapon --show
These sets of commands were used successfully, to increase the size of a partition, from 32GB to 64GB - after increasing the size in Proxmox.

Updated: Tuesday 29th September 2026, 22:22am

There are 0 comments

Leave a comment of your own

Comments are currently closed.