I run debian 10 on all my proxmox VM's. It's a fairly simple setup. Today I wanted to grow a disk. So I went to proxmox, picked a disk, and said resize, ok, +8GB, done.
Then I went into fdisk to fix it.. and something stupid happened.
Command (m for help): p
Disk /dev/sda: 24 GiB, 25769803776 bytes, 50331648 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: dos
Disk identifier: 0xba9e1ff8
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 499711 497664 243M 83 Linux
/dev/sda2 501758 50331647 49829890 23.8G 5 Extended
/dev/sda5 503808 50331647 49827840 23.8G 83 Linux
<delete 2, make new>
Command (m for help): p
Disk /dev/sda: 24 GiB, 25769803776 bytes, 50331648 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: dos
Disk identifier: 0xba9e1ff8
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 499711 497664 243M 83 Linux
/dev/sda2 501758 50331647 49829890 23.8G 5 Extended
<now re-add 5 with same offset>
Command (m for help): n
All space for primary partitions is in use.
Adding logical partition 5
First sector (503806-50331647, default 503808): 501760
Value out of range.
Argh. Ok.. fine. Parted?
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) resizepart
Partition number? 2
End? [17.2GB]? -1s
(parted) print
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 25.8GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 256MB 255MB primary ext2 boot
2 257MB 25.8GB 25.5GB extended
5 257MB 17.2GB 16.9GB logical lvm
(parted) unit s
(parted) p
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 50331648s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 2048s 499711s 497664s primary ext2 boot
2 501758s 50331647s 49829890s extended
5 501760s 33552383s 33050624s logical lvm
(parted) resizepart
Partition number? 5
End? [33552383s]? -1s
(parted) print
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 50331648s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 2048s 499711s 497664s primary ext2 boot
2 501758s 50331647s 49829890s extended
5 501760s 50331647s 49829888s logical lvm
Boom.. perfect. Yes. use parted.