Resource icon

HOWTO: Resize a Linux VM's LLVM Virtual Disk on a ZVOL

Stux

MVP
Joined
Jun 2, 2016
Messages
4,367
Stux submitted a new resource:

HOWTO: Resize a Linux VM's LLVM Virtual Disk on a ZVOL - So your Linux VM needs more space?

If you have a Linux VM, which uses the LLVM filesystem, you can easily increase the disk space available to the VM.

Linux Logical Volume Manager allows you to have logical volumes (LV) on top of logical volume groups (VG) on top of physical volumes (PV) (ie partitions).

This is conceptually similar to zvols on pools on vdevs in zfs.

This was tested with TrueNAS-CORE 12 and Ubuntu 20.04.

Firstly, there are some useful commands:

pvs - list physical volumes
vs - list...

Read more about this resource...
 
Last edited:

Stux

MVP
Joined
Jun 2, 2016
Messages
4,367
Just used this procedure on another VM. works perfectly, and it seems the command lines are exactly correct assuming you have an Ubuntu 20.04 default install too.
 

zierbeek

Explorer
Joined
Apr 4, 2021
Messages
54
I have followed this guide already several times. But now, I get when using lv extend:


sudo lvextend --resizefs ubuntu-vg/ubuntu-lv /dev/sda3
Size of logical volume ubuntu-vg/ubuntu-lv changed from <58.50 GiB (14975 extents) to <98.50 GiB (25215 extents).
Logical volume ubuntu-vg/ubuntu-lv successfully resized.
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required
old_desc_blocks = 6, new_desc_blocks = 13
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 25820160 (4k) blocks long.
 

Stux

MVP
Joined
Jun 2, 2016
Messages
4,367
Did you restart the VM after changing the ZVol size?
 

ChrisChros

Patron
Joined
Nov 24, 2018
Messages
218
Hi, thanks for the instruction.
I have a Debian VM up and running and I run the the following problem. I seperately installed lvm2 via command
sudo apt-get install lvm2
but when I trie to use the lvs command I run in this problem:
Code:
debian@debian:~$ lvs
-bash: lvs: Kommando nicht gefunden.

Code:
debian@debian:~$ sudo lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  200G  0 disk
├─sda1   8:1    0  512M  0 part /boot/efi
├─sda2   8:2    0  8,5G  0 part /
└─sda3   8:3    0  976M  0 part [SWAP]


How can I fix this?
 
Last edited:

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
You are not using LVM for your Linux partitions inside the VM. What you need to do:
  • disable swap
  • delete the swap partition sda3
  • increase the size of sda2 (leaving space for a new swap partition)
  • create a new swap partition as sda3
  • change the swap entry in /etc/fstab
  • expand the filesystem in sda2
On how precisely to go about these steps I would have to consult the search engine of least distrust as well. Check if your distribution comes with an fdisk or a gpart or gparted command and continue from there.
 

ChrisChros

Patron
Joined
Nov 24, 2018
Messages
218
@Patrick M. Hausen Thanks for your suggestions.
When I mount a gparted live iso-image as a CD-drive within the VM I should be able to boot to the live image during startup?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
You can use gparted in your live system. If you want to boot from an ISO you need to create a CDROM device for the VM in TrueNAS.
 

KrisBee

Wizard
Joined
Mar 20, 2017
Messages
1,288

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
@KrisBee Look at his lsblk output - no volume manager.
 

KrisBee

Wizard
Joined
Mar 20, 2017
Messages
1,288
@KrisBee Look at his lsblk output - no volume manager.
I've seen that. I've no idea what the OP is trying to achieve by installing lvm2 in their debian VM. I'm only answering their "I run into a problem" question, ie. all lvm2 commands require root permissions.
 
Top