VM Harddrive Configuration

Jan 19, 2021
6
0
1
I recently installed Ubuntu 20.04 in a new VM on local-lvm on a single node Proxmox VE 6.4-8 set-up running on bare metal at a data-center.

In the Proxmox "Create VM" wizard I chose 40GB for the size of the VM.

On the Ubuntu 20.04 installation, during the disk partition config, I chose the defaults. I ended up with 20GB of usable space. I need more.

What is the simplest/safest way to get more usable space for this VM?

Thanks in advance.

Code:
df -h
Filesystem                         Size  Used Avail Use% Mounted on
udev                               6.9G     0  6.9G   0% /dev
tmpfs                              1.4G 1008K  1.4G   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   20G   19G   13M 100% /
tmpfs                              6.9G     0  6.9G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              6.9G     0  6.9G   0% /sys/fs/cgroup
/dev/sda2                          976M  107M  803M  12% /boot
/dev/loop1                         100M  100M     0 100% /snap/core/11187
/dev/loop2                          56M   56M     0 100% /snap/core18/1944
/dev/loop0                          15M   15M     0 100% /snap/aws-cli/130
/dev/loop5                          70M   70M     0 100% /snap/lxd/19188
/dev/loop3                          56M   56M     0 100% /snap/core18/2074
/dev/loop4                          68M   68M     0 100% /snap/lxd/20326
/dev/loop7                          32M   32M     0 100% /snap/snapd/10707
/dev/loop6                          33M   33M     0 100% /snap/snapd/12159
tmpfs                              1.4G     0  1.4G   0% /run/user/1000



Code:
parted -l
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  2097kB  1049kB                     bios_grub
 2      2097kB  1076MB  1074MB  ext4
 3      1076MB  42.9GB  41.9GB


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number  Start  End     Size    File system  Flags
 1      0.00B  21.5GB  21.5GB  ext4


Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0
has been opened read-only.
Model: QEMU QEMU DVD-ROM (scsi)                                           
Disk /dev/sr0: 1215MB
Sector size (logical/physical): 2048B/2048B
Partition Table: mac
Disk Flags:

Number  Start  End     Size    File system  Name   Flags
 1      2048B  6143B   4096B                Apple
 2      698kB  4794kB  4096kB               EFI
 
The problem is the Ubuntu installer. Looks like the lastest version is only using 50% of the virtual drives capacity for the root LV. But you can tell it while installing to use the full 40GB if you manually partition the disk. I've read the same topic some day ago in another thread.
 
Last edited:
The problem is the Ubuntu installer. Looks like the lastest version is only using 50% of the virtual drives capacity for the root LV. But you can tell it while installing to use the full 40GB if you manually partition the disk. I've read the same topic some day ago in another thread.
Do I need to start from scratch?
 
What are lvs and vgs reporting?
I think it should be possible to use the LVM commands to extend the VG and LV.
 
Code:
sudo lvs
LV        VG        Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  ubuntu-lv ubuntu-vg -wi-ao---- 20.00g 
sudo vgs
VG        #PV #LV #SN Attr   VSize   VFree  
  ubuntu-vg   1   1   0 wz--n- <39.00g <19.00g
 
I found this tutorial: https://www.linuxtechi.com/extend-lvm-partitions/

Then I ran these commands. To found out the name of the volume group I ran:
Code:
sudo vgscan
Then I ran this to get the clearest view of things:
Code:
vgdisplay < Volume-Group-Name>

# which in my case was:
sudo vgdisplay ubuntu-vg

# then to set resize in config
sudo lvextend -L +16G /dev/mapper/ubuntu--vg-ubuntu--lv
# and then to implement the resize
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

All good now. Thanks.
 

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!