Resizing a VM: two questions

microlinux

New Member
Mar 30, 2021
17
1
3
57
Hi,

I'm using the following procedure to resize (e. g. expand) a VM:

Datacenter > sd-155842 > Oracle-Linux-7.9 > Hard disk > Resize disk > Size Increment (GB) : 10

Start the VM and connect to it.

Code:
# yum install cloud-utils-growpart
# lsblk
# growpart -v /dev/sda 3
# resize2fs /dev/sda3

Note : /dev/sda3 is the last partition on the disk and sports an ext4 filesystem.

Q1: is this a trivial procedure that can be used without even giving it a thought or is there some potential risk of data loss?

Q2: Can this procedure be somehow reversed without having to jump through burning loops, e. g. shrink the root partition when there's (too) much space available?

Cheers,

Niki
 
Q1: is this a trivial procedure that can be used without even giving it a thought or is there some potential risk of data loss?
risk ~ 0%
you can do it by hand with fdisk (recereate target partition with same start block address and new end block address without delete FS signature) + run resize2fs.
Also, it can be done fully online (without poweroff VM) with virtio scsi.
After resize FS recommended run fsck (this operation require unmount partition)
 
  • Like
Reactions: microlinux

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!