This is an old revision of the document!
Start defualt
sudo virsh net-start default
Remove bridge
sudo ifconfig virbr0 dow sudo brctl delbr virbr0
List all
sudo virsh net-list --all
Simple bridge mode for virt-manager - how to create it if you deleted or broke it. I used manual commands, but one could use the brctl command.
sudo nano /etc/network/interfaces
auto br1 iface br1 inet dhcp bridge_ports enp3s0 bridge_stp on bridge_fd 0.0
Resize an .img with virt-manager, for example, expanding a 64GB disk to a 124GB disk. Start by installing the optional tools for this:
sudo apt install libguestfs-tools
After that, confirm the location of your virtual machine. You need to know the actual name of the .img file for this to work. Usually (unless it was changed by someone), this is the name that appears in the virt-manager window.
virsh dumpxml putnameofimagehere | xpath -e /domain/devices/disk/source
Navigate to the directory it spit out, and back up the image and rename it before you proceed:
cd /var/lib/libvirt/images/ sudo cp /var/lib/libvirt/images/putnameofimagehere.img /var/lib/libvirt/images/putnameofimagehere.img.bak
Once you know the name of the .img file and the location of it, prepare the virtual file systems for expansion:
virt-filesystems --long --parts --blkdevs -h -a /var/lib/libvirt/images/putnameofimagehere.img
Build a new, larger, container for the final disk, and set it aside for the merge/expansion that the tools are going to provide:
truncate -s 128G /var/lib/libvirt/images/outdisk
Now it is time to resize the existing image, using the container you just created:
virt-resize --expand /dev/sda2 /var/lib/libvirt/images/putnameofimagehere.img /var/lib/libvirt/images/outdisk
Okay, now we need to rename the new image we created to the name that virt-manager is looking for, i.e., the name of the original image. Remember, you should have the .bak file you made earlier in case this does not work. This is done as follows:
cp /var/lib/libvirt/images/putnameofimagerhere.img /var/lib/libvirt/images/putnameofimagerhere.img.old mv /var/lib/libvirt/images/outdisk /var/lib/libvirt/images/putnameofimagehere.img
Reboot the machine once this is completed. After that, log in and test the virtual machine:
sudo reboot ssh -X user@xx.xx.xx.xx virt-manager
When the virt-manager window opens, select the virtual machine and boot it up. You should find that the same OS is there, in tact, etc., and yet is now twice the size! Sometimes the machine does not work because you user needs to be added to the libvirt group, here is how:
sudo usermod --append --groups libvirt `whoami`
Need the machine to run at boot?
sudo -i virsh autostart <vmname>
Need to turn it off?
virsh autostart <vmname> --disable
Create bridge interface and bind to host ethernet within libvirt / virsh:
sudo ip link add name vmbr0 type bridge sudo ip link set enp7s0f0 master vmbr0 sudo ip a a 8.18.76.163/32 dev vmbr0 brd 8.18.76.255 sudo route add default gw 8.18.76.1
— oemb1905 2019/04/10 10:22