Creating a Ubuntu Server qemu VM in a Logical Volume

Running Ubuntu Mate 24.04
Virt Manager 4.1.0

I would like to install ubuntu server in a lv I have created - I use Virt Manager (GUI) to create my VMs. When it comes (using Virt Manager) to selecting the storage I choose the Manage option … where I can choose the location/storage for the vm. If I Add Pool (click on green + icon) I can choose a name of the storage pool, the type and the target path. Under the choice of Types the only LVM type option is logical: LVM Volume Group which then auto fills the Volgroup Name box with the name of my VG. This works but I would like the storage location to be a specific LV e.g. /dev/vg01/server and not /dev/vg01. Looks to me it is not possible, using Virt Manager, to install a vm in a LV that you have created for it. Any advice appreciated.

Each pool you define is a VG. If you then select the pool of the VG you want to use, the LVs in that VG appear on the right. Select the LV you want to use for storage from that list on the right side. The picture should make this clear.

Dennis_N - thank you. Before I address what you said above I would like your advice on an associated issue I have. Once this is cleared up I can go back to my original issue.

I realised a few days ago that I didn’t really understand these libvirt/vm pools and exactly how they worked. I fear I have created too many pools over the months and would like to ‘clean things up’ if possible. At the moment my working system is simple, I have only one VG (and will probably only ever have one VG) and two active LVs (one for my root / and one for my home /home).

dad@dadubuntu:~$ sudo lvscan
  ACTIVE            '/dev/vg01/root' [80.00 GiB] inherit
  ACTIVE            '/dev/vg01/home' [400.00 GiB] inherit

At the moment I have two other LVs (/dev/vg01/ubserver and /dev/vg01/mint) ready for new virtual machines.

I have got into a mess, re pools, as can be seen in the attached screenshots - I seem to have duplicate pools, although they have different names. My concern about deleting these pools (whether via Virt Manager or the command line) is that most of these pools contain volumes for home (400GB) and root (80GB) - if I were to delete one or more of these pools would I lose my / and /home? Also, although not shown/attached there is a pool called Downloads which indeed is my /home/dad/Downloads folder. If I were to delete this pool I’m guessing it would not actually affect the Downloads folder itself - just the ‘pointer’ within libvirt that is pointing to /home/dad/Downloads - is this the case?

.



Philosophically, if I want to create a VM for any reason, my thinking is to create a new LV and put it in there - away from my / and /home. However, I’m wondering if this is the best way of doing things. This thinking originated from when I first ‘played’ with qemu and found my / was filling up due to images being located in /var/lib/libvirt/images/

Deleting a pool doesn’t delete anything on your disk. A ‘pool’ is like a label you attach to something to find it later. You can delete pools.

a pool of type dir - is a folder in your file system to store .qow2 vms or other assets, like iso files.

a pool of type logical - is an lvm volume group that contains some LVs. The LVs could be used as VM disks. Or you can do a regular non-vm install on an LV as well. Each LV would then be a place for a specific file system like root, home, etc. In a single pool you can have some LVs that are VMs, and others that are used for normal OS installations.

By the way, you can use this same dialog to create new LVs for a pool by using the ‘+’ button above the LV listing, or actually delete an LV with the trash button.

I usually add ‘vm’ to an LVs name if its a virtual machine. Ubuntu_2510_vm for example.

Yes, I agree. I don’t use this default location for VMs. Your root will soon fill up (unless its really huge).

I need to add that you can’t do this with the current Ubuntu desktop installer. Other OS installers, like Fedora’s, can. The old Ubuntu installer, Ubiquity, could also do this.

With Ubuntu’s installer, you can only do ‘erase and install’ to get an LVM system.

This topic was automatically closed after 30 days. New replies are no longer allowed.