[SOLVED] Resize an LVM disk located on ZFS storage...

Dubard

Active Member
Oct 5, 2016
61
2
28
48
Switzerland
Hi everybody,

I want to resize (add 20 Go) to a LMV disk on ZFS storage.
I managed to enlarge from the GUI the LVM disk assigned to my VM (KVM type). Then I restarted this VM because the capacity of its disk still displays the old size. But, rebooting wasn't enough... i still have the old size on display :(

Is there another command I need to do to resize the disk on the VM ?

Many thanks
 
Last edited:
If the virtual disk is enlarged you still need to adapt whatever you have on the disk inside the VM to the larger size. That can be the partition table, file system or LVM.
 
Thanks aaron for your reply !

I want to enlarge the "/" partition...how can I do that inside the VM ?

Can I do this "live" without fear that my data will be erased ?


Many thanks
 
It depends heavily on how your guest OS set up the disk. A general valid answer cannot be given on how to do it exactly.

The basic rule when expanding is to go from outside to inside.
For example, if you have a simple setup:
Extend VM disk -> extend partition -> extend file system

If the guest is using other layers (e.g. LVM) you need to handle it accordingly.

Before embarking on these changes it is a good idea to create a snapshot of the guest, if possible a backup is a good idea too.

Is your guest a Linux guest? Running lsblk in the guest should give a good overview on how the disk is organized.
 
Yes, I specify that it's a VM under Linux (Debian) here's what the disk organization looks like:

Code:
root@mydebian:/# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0     11:0    1 1024M  0 rom  
vda    254:0    0   80G  0 disk 
├─vda1 254:1    0   58G  0 part /
└─vda2 254:2    0    2G  0 part [SWAP]
root@mydebian:/#
root@mydebian:/# fdisk -l

Disque /dev/vda : 80 GiB, 85899345920 octets, 167772160 secteurs
Unités : secteur de 1 × 512 = 512 octets
Taille de secteur (logique / physique) : 512 octets / 512 octets
taille d'E/S (minimale / optimale) : 512 octets / 512 octets
Type d'étiquette de disque : dos
Identifiant de disque : 0x11b7e7c3

Device     Boot   Start       End   Sectors Size Id Type
/dev/vda1  *    4196352 125829119 121632768  58G 83 Linux
/dev/vda2          2048   4196351   4194304   2G 82 Linux swap / Solaris

Les entrées de la table de partitions ne sont pas dans l'ordre du disque.
root@mydebian:/#
root@mydebian:/# df -h
Sys. de fichiers                                                                                                Taille Utilisé Dispo Uti% Monté sur
/dev/vda1                                                                                                          57G     49G  6.0G  90% /
udev                                                                                                               10M       0   10M   0% /dev
tmpfs                                                                                                             2.0G     25M  2.0G   2% /run
tmpfs                                                                                                             4.9G    444K  4.9G   1% /dev/shm
tmpfs                                                                                                             5.0M       0  5.0M   0% /run/lock
tmpfs
root@mydebian:/#

The disk is the right size (80GB). Now I would like to enlarge the "/" partition (/dev/vda1)

Should I boot the VM from a live CD and resize the "/" partition or can I do it "live" directly from the VM ?
If I can do this in "live" what are the commands I have to use ?

Many thanks
 
Last edited:
Okay, a somewhat simple setup. I would recommend you to boot the VM with a live CD iso. AFAIK Ubuntu isos come with the graphical partition manager gparted. With that, it should be quite easy to move the swap partition to the end of the disk and enlarge the data partition.

Don't forget to back up the VM and to create a snapshot before you attempt to do this.
 
Great. Please mark the thread as solved by editing the first post and setting the title prefix accordingly. :)
 

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!