Resize/partition VM disk ?

atom6

Member
Dec 16, 2020
5
0
6
I resized my vmdisk via gui - currently 72GB (rebooted VM after change)

SCR-20230702-idne.png

Inside the VM - I see the disk size:

Code:
SYSTEM DISK USAGE
Drives:    Local Storage: total: 72 GiB used: 44.66 GiB (62.0%)
           ID-1: /dev/sda vendor: QEMU model: HARDDISK size: 72 GiB


Filesystem is not taking up all the space:

Code:
captain@enterprise:~$ df -h
Filesystem                Size  Used Avail Use% Mounted on
udev                      1.9G     0  1.9G   0% /dev
tmpfs                     393M  900K  392M   1% /run
/dev/sda2                  30G   23G  6.1G  79% /
tmpfs                     2.0G     0  2.0G   0% /dev/shm
tmpfs                     5.0M     0  5.0M   0% /run/lock
/dev/sda1                 512M  5.9M  506M   2% /boot/efi
10.0.0.60:/storage/media   21T   12T  9.8T  54% /mnt/media
tmpfs                     393M  4.0K  393M   1% /run/user/1000

fdisk shows unpartitioned space:

Code:
Command (m for help): F
Unpartitioned space /dev/sda: 40 GiB, 42950704640 bytes, 83888095 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

   Start       End  Sectors Size
67106816 150994910 83888095  40G

I would like to add this space to /dev/sda2
How do continue from here ?
 
Hello,

try cfdisk. New versions let resize partitions on hot, and then use resize2fs.

Anyway, you should use LVM.
 
Hello,

try cfdisk. New versions let resize partitions on hot, and then use resize2fs.

Anyway, you should use LVM.
Thanks, many words - which don't make sense to me.
Can I resize the current setup ? If yes, what should I do/type ?
 
Hello,

you need to resize the partition first, and then you need to resize the filesystem on it.

To resize the partition you can try cfdisk

$ sudo cfdisk /dev/sda

if you can see Free Space at the end, select the /dev/sda2 partition and then select resize. If no errors go to write and quit. Later you need to resize the filesystem.

$ sudo resize2fs /dev/sda2

and this is it.
 

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!