KVM host, add LV to guest


Bafast

I have a KVM host with a software RAID 10 array. A software RAID 10 array is a PV on the host, with only one VG.

I'm using several LVs ( data storage for KVM guest .imgfiles ) at the host level.

Typically, when adding a new disk to the guest, I create an LV on the host and then add it to the guest's configuration. Then pvcreatedirectly on the block device (no partitions) vgcreate, lvcreateand mkfson the new block device within the guest.

Until then, I don't have to partition the block device anymore, pvcreatebecause it's one less step to do when resizing the LV on the host. I realize the theoretical downside is that some systems might decide to auto-partition unpartitioned block devices because they don't recognize LVM metadata, although I've never seen this happen in practice.

When adjusting the PV free space to pick up the LV on the host, I want to vgextend, lvextendand resize2fson the guest.
I don't think there is a way to skip having LVM running in the guest and run it lvextendin the host first and then resize2fsin the guest?

Larva

I don't think there is a way to skip having LVM running in the guest and just do lvextend on the host and then resize2fs in the guest?

There is absolutely no need to use LVM inside the guest. You can use block devices directly. Using LVM inside the guest gives you almost nothing (since you're already using LVM on the host to manage space).

If you mean "libvirt" by "KVM", virsh blockresizeafter resizing the block device , you can use the command to make the guest recognize the extra space. That is, if I have a visitor with an additional LV:

</disk><disk type="block" device="disk">
  <driver name="qemu" type="raw"/>
  <source dev="/dev/tank/foobar"/>
  <backingStore/>
  <target dev="vdb" bus="virtio"/>
  <alias name="virtio-disk1"/></disk>

Where:

# lvs
  foobar                                      tank           -wi-ao----   4.00g                                                              

I can add space on the LV on the host:

# lvresize -L +2G /dev/tank/foobar

Tell libvirt to update the size:

# virsh blockresize myguest /dev/tank/foobar --size 0

Then inside the guest, resize the file:

guest# resize2fs 1.42.12 (29-Aug-2014)
Resizing the filesystem on /dev/vdb to 1572864 (4k) blocks.
The filesystem on /dev/vdb is now 1572864 (4k) blocks long.

Related


KVM host, add LV to guest

Bafast I have a KVM host with a software RAID 10 array. A software RAID 10 array is a PV on the host, with only one VG. I'm using several LVs ( data storage for KVM guest .imgfiles ) at the host level. Typically, when adding a new disk to the guest, I create a

Host CPU temperature in KVM guest

Yun-Chih Chen I am trying to use to lm_sensorsdetect host CPU temperature in a KVM guest. In the host, after inserting the x86_pkg_temp_thermal kernel module, the sysfs interface /sys/class/thermal/thermal_zone*/tempwill display the required information. Here

Host CPU temperature in KVM guest

Yun-Chih Chen I am trying to use to lm_sensorsdetect host CPU temperature in a KVM guest. In the host, after inserting the x86_pkg_temp_thermal kernel module, the sysfs interface /sys/class/thermal/thermal_zone*/tempwill display the required information. Here

How to copy paste from host to KVM guest?

Ellopio I have a QEMU/KVM virtual machine created with Virtual Machine Manager. I want to be able to copy text on the host and paste it into the guest and vice versa. How to share clipboard between host and guest? Ellopio The solution is simple. Just install t

Unable to resume KVM guest after rebooting host

Japanese and Chinese I'm running KVM on Linux Mint 17.1, kernel 3.16.0-31-generic. The only guest is a Windows 8.1 VM. I noticed that if the host is restarted while the guest is running, the guest cannot be recovered after the host restarts. Virt-manager just

KVM guest access host USB serial dongle

Sardathrion - Preventing SE Abuse I have a KVM virtual machine running CentOS 7 on a host running Fedora 24. I installed a USB serial dongle (actually an RFID reader, but that should be fine) on that host. The host can see it after running: sudo modprobe usbse

KVM host networking - guest connection issues

Mike Souler There seems to be a lot of stuff on this topic already, so apologies for adding information, but I haven't had any luck finding anything that can solve my problem. My guests can't ping my default gateway, but my host can ping my default gateway. I

How to copy paste from host to KVM guest?

Ellopio I have a QEMU/KVM virtual machine created with Virtual Machine Manager. I want to be able to copy text on the host and paste it into the guest and vice versa. How to share clipboard between host and guest? Ellopio The solution is simple. Just install t

How to copy paste from host to KVM guest?

Ellopio I have a QEMU/KVM virtual machine created with Virtual Machine Manager. I want to be able to copy text on the host and paste it into the guest and vice versa. How to share clipboard between host and guest? Ellopio The solution is simple. Just install t

Unable to resume KVM guest after rebooting host

Japanese and Chinese I'm running KVM on Linux Mint 17.1, kernel 3.16.0-31-generic. The only guest is a Windows 8.1 VM. I noticed that if the host is restarted while the guest is running, the guest cannot be recovered after the host restarts. Virt-manager just

KVM guest access host USB serial dongle

Sardathrion - Preventing SE Abuse I have a KVM virtual machine running CentOS 7 on a host running Fedora 24. I installed a USB serial dongle (actually an RFID reader, but that should be fine) on that host. The host can see it after running: sudo modprobe usbse

KVM host networking - guest connection issues

Mike Souler There seems to be a lot of stuff on this topic already, so apologies for adding information, but I haven't had any luck finding anything that can solve my problem. My guests can't ping my default gateway, but my host can ping my default gateway. I

KVM: VPN host, guest needs VPN and host access to NFS

diagonal I'm running an Ubuntu guest in KVM, which in turn runs on an Ubuntu host. The host network goes through a VPN (OpenVPN), providing tun0. I need the guest network to go through the VPN as well, except I need to be able to access the host over the netwo

KVM: VPN host, guest needs VPN and host access to NFS

diagonal I'm running an Ubuntu guest in KVM, which in turn runs on an Ubuntu host. The host network goes through a VPN (OpenVPN), providing tun0. I need the guest network to go through the VPN as well, except I need to be able to access the host over the netwo

Add Virtualbox guest on Ubuntu host and Manjaro guest

Farzad I have installed Manjaro in a guest VM on an Ubuntu 18.10 host, but I cannot use the guest additions in the Manjaro guest. I have installed the kernel 5.1.1-2in Manjaro and the output uname -ris: 5.1.1-2-MANJARO Then I tried to install virtualbox-guest

Add Virtualbox guest on Ubuntu host and Manjaro guest

Farzad I have installed Manjaro in a guest VM on an Ubuntu 18.10 host, but I cannot use the guest additions in the Manjaro guest. I have installed the kernel 5.1.1-2in Manjaro and the output uname -ris: 5.1.1-2-MANJARO Then I tried to install virtualbox-guest

Ubuntu Server 18.04.1 guest on Ubuntu Server 18.04.1 host, KVM

user3006062 I'm trying to install an Ubuntu Server 18.04.1 guest on an Ubuntu Server 18.04.1 host using KVM. I have downloaded ubuntu-18.04.1-live-server-amd64.iso to the host. When I run the following command: sudo virt-install -n marmoset-eugo-1 --descriptio

Host CPU does not scale frequency when required by KVM guest

Huygens Observation: I have an HP server with an AMD dual core CPU (Turion II Neo N40L) that can scale the frequency from 800 to 1500 MHz. Frequency scaling is available under Ubuntu 12.04 with FreeBSD 9 and Linux kernel 3.5. However, when I put FreeBSD 9 in a

Host CPU does not scale frequency when required by KVM guest

Huygens Observation: I have an HP server with an AMD dual core CPU (Turion II Neo N40L) that can scale the frequency from 800 to 1500 MHz. Frequency scaling is available under Ubuntu 12.04 with FreeBSD 9 and Linux kernel 3.5. However, when I put FreeBSD 9 in a

How to prevent time drift in Debian guest on CentOS KVM host?

username I know I can install ntpin the guest , but the suggestions that have confused me so far from googling suggest that it's not necessary. The host is CentOS 6.3 and the guest is Debian Wheezy, which seems to use the kvm clock as the time source: # cat /s

Share folder from host to guest VM using KVM

OK I want to share a folder from the host machine (Linux) to a Linux VM that is running on it. After some research, I used the 9p (version=9p2000.L) share, following the instructions on the link below: http://www.linux-kvm.org/page/9p_virtio Problem: I can't r

nat configuration for qemu-kvm guest and host networking

go ahead Under Ubuntu 18.04 host, I have setup Ubuntu 10.04 guest VM from cloned HD. The VM starts normally and I can ssh into it from the host, but it cannot communicate outside the host. My question is what is wrong with my following configuration: Guest VM:

High KVM host CPU usage for Win10 guest

Mr. Calvin Some time ago, it was noticed that Windows 10 1803 WM would give high CPU usage on the host, say 25%, even though the client CPU usage was 0%. Solved this by having the following settings in the virt XML file: <hyperv> <relaxed state='on'/> <