How to increase hard drive size

hendr1x

Member
Dec 14, 2019
28
0
21
41
Hello everyone,
I'm am unable to increase the size of my hard drive. All the guides I found are for a different storage configuration and are assuming the partition is not the primary (running/used) for the VM. Can some one please help me figure out how to increase the size of the disk on my VM?

First I resized the disk in proxmox gui from 16 to 64g

From there, all guides/commands I were given produce errors. VM is running debian 10.


Code:
root@gitlab:~# parted
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 68.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type      File system     Flags
 1      1049kB  15.0GB  15.0GB  primary   ext4            boot
 2      15.0GB  17.2GB  2144MB  extended
 5      15.0GB  17.2GB  2144MB  logical   linux-swap(v1)

(parted) resizepart 1 100%
Warning: Partition /dev/sda1 is being used. Are you sure you want to continue?
parted: invalid token: 100%
Yes/No? n
(parted) ^C

Disk Info :

Code:
root@gitlab:~# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   64G  0 disk
├─sda1   8:1    0   14G  0 part /
├─sda2   8:2    0    1K  0 part
└─sda5   8:5    0    2G  0 part [SWAP]
sr0     11:0    1 1024M  0 rom

I would really appreciate any help you could provide
 
I can't get it work.


Code:
root@gitlab:~# growpart /dev/sda 1
NOCHANGE: partition 1 could only be grown by 2046 [fudge=2048]!


Code:
root@gitlab:~# resize2fs /dev/sda1
resize2fs 1.44.5 (15-Dec-2018)
The filesystem is already 3670016 (4k) blocks long.  Nothing to do!

Code:
root@gitlab:~# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   64G  0 disk
├─sda1   8:1    0   14G  0 part /
├─sda2   8:2    0    1K  0 part
└─sda5   8:5    0    2G  0 part [SWAP]
sr0     11:0    1 1024M  0 rom

Any ideas? I have no idea what to do
 
Last edited:
resizefs , as the name implies, resizes the filesystem. Since you have not extended the partition on which the filesystem is located - you cant use resizefs.

"man growpart":
Code:
Rewrite a partition table in a disk or disk image so that the given partition takes up as much space as it can.  After running, the partition will end at the end of the disk, or at  the  beginning of the next partition.

you can't use growpart because your first partition already ends at the beginning of the second one.

The easiest way for you is to rebuild the VM with appropriate sizes.

If for some reason you still want to keep existing data/partition, then first make sure you have a backup. You are always a step away from destroying your data.

Once you ensured that you have good backup, then the next step is to boot without swap (see fstab). Then delete partitions 2 and 5. Then follow whatever procedure to extend the partition that most appeals to you. Dont forget to recreate the swap.

Or you can use one of many fancy GUI partition management apps that give you user friendly slide and drag&drop options.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!