[SOLVED] Extend VM drive when linux FS is first entry

whiteviberson

Member
Jun 23, 2022
3
0
6
Hello,
My VM has run out of storage on its virtual drive. I went to extend the drive in proxmox, then I realized I would have to extend the partition in the VM as well. The problem is that the linux file system is the first partition on the drive with the swap and extended, so I cannot just move the endpoint.

My questions are:
1. Can I fix this?
2. How do I prevent proxmox from making the filesystem like this in the future? Or was it openmediavault that partitioned the drives in this order?

Thanks!
 
1. Don't use partition ;) you can simply format your drive like "mkfs.ext4 /dev/sda".
put the swap on another virtual disk.



2. Proxmox is not creating the partition or filesystem in your vms. This is the installer of your distro.
So move the swap to a new drive then just extend the drive. That makes sense, but what about the extended filesystem? Here is a image of the drive I am trying to extend. Will removing /dev/vda2 of type Extended do anything? Also, I don't really want to reconfigure everything - it seems like "mkfs.ext4 /dev/vda" would wipe the drive and I would have to redo my server. Is that incorrect?

linuxfs.PNG
 
Last edited:
So move the swap to a new drive then just extend the drive. That makes sense, but what about the extended filesystem? Here is a image of the drive I am trying to extend. Will removing /dev/vda2 of type Extended do anything? Also, I don't really want to reconfigure everything - it seems like "mkfs.ext4 /dev/vda" would wipe the drive and I would have to redo my server. Is that incorrect?

View attachment 38305
SOLUTION:
There are probably easier ways, but I turned off swap, deleted the vda2 and vda5 then extended in gparted live environment. The swap partition lives inside the "Extended" partition I think, so the vda2 was basically the same as the swap. There was no issue with deleting both. I left about 10Gb of space for swap, and remade the swap partition using fdisk and reenabled swap and I am now good to go.
 
SOLUTION:
There are probably easier ways, but I turned off swap, deleted the vda2 and vda5 then extended in gparted live environment. The swap partition lives inside the "Extended" partition I think, so the vda2 was basically the same as the swap. There was no issue with deleting both. I left about 10Gb of space for swap, and remade the swap partition using fdisk and reenabled swap and I am now good to go.
You may also have to remove the fstab entry. Some system will hang if it was previously there but isn't there anymore.

On recent/up-to-date linux systems, you can do that all online, so no need for gparted live.