KVM: Difference between revisions

From 太極
Jump to navigation Jump to search
No edit summary
Line 47: Line 47:
virsh edit ubuntu16.04
virsh edit ubuntu16.04
</pre>
</pre>
</li>
<li>Network
<ul>
<li>Host only (used by VirtualBox) = '''Isolated network''' (used by KVM). Step 1: Select a VM. Click Edit, choose "Connection Details" and add a new network (Isolated mode). This ''default'' network has IPv4 192.168.122.0/24 Step 2: Click Edit, choose "Virtual machine Details" and click the Information icon (circle shape). Click "Add Hardware" and choose "Isolated network" for the Network source. Leave the MAC address and Device model as defaults. This ''network'' network has IP4 192.168.100.0/24.
<li>[https://www.golinuxcloud.com/configure-bridged-network-in-virt-manager/ How to configure bridged network in virt-manager (CentOS / RHEL 7)] </li>
<li>[https://linuxconfig.org/install-and-set-up-kvm-on-ubuntu-20-04-focal-fossa-linux#h2-configure-the-network-bridge Install And Set Up KVM On Ubuntu 20.04 Focal Fossa Linux] </li>
<li>[https://fabianlee.org/2019/04/01/kvm-creating-a-bridged-network-with-netplan-on-ubuntu-bionic/ KVM: Creating a bridged network with NetPlan on Ubuntu bionic] </li>
<li>[https://wiki.libvirt.org/page/VirtualNetworking VirtualNetworking] </li>
<li>[https://libvirt.org/formatnetwork.html Network XML format] </li>
<li>[https://amoldighe.github.io/2017/12/20/kvm-networking/ KVM Networking - NAT & Host-Only] </li>
<li>[https://www.pitt-pladdy.com/blog/_20150620-151456_0100_Home_Lab_Project_Network_Bridges_for_KVM_-_NAT_Host-only_Isolated/ Home Lab Project: Network Bridges for KVM - NAT, Host-only, Isolated] </li>
</ul>
</li>
</li>
</ul>
</ul>
Line 130: Line 118:
<li>[https://ostechnix.com/how-to-manage-kvm-virtual-machines-with-virt-manager/ How To Manage KVM Virtual Machines With Virt-Manager] </li>
<li>[https://ostechnix.com/how-to-manage-kvm-virtual-machines-with-virt-manager/ How To Manage KVM Virtual Machines With Virt-Manager] </li>
</ul>
</ul>
= Network =
<ul>
<li>Host only (used by VirtualBox) = '''Isolated network''' (used by KVM). Step 1: Select a VM. Click Edit, choose "Connection Details" and add a new network (Isolated mode). This ''default'' network has IPv4 192.168.122.0/24 Step 2: Click Edit, choose "Virtual machine Details" and click the Information icon (circle shape). Click "Add Hardware" and choose "Isolated network" for the Network source. Leave the MAC address and Device model as defaults. This ''network'' network has IP4 192.168.100.0/24.
<li>[https://www.golinuxcloud.com/configure-bridged-network-in-virt-manager/ How to configure bridged network in virt-manager (CentOS / RHEL 7)] </li>
<li>[https://linuxconfig.org/install-and-set-up-kvm-on-ubuntu-20-04-focal-fossa-linux#h2-configure-the-network-bridge Install And Set Up KVM On Ubuntu 20.04 Focal Fossa Linux] </li>
<li>[https://www.tecmint.com/create-network-bridge-in-ubuntu/ How to Configure Network Bridge in Ubuntu]</li>
<li>[https://fabianlee.org/2019/04/01/kvm-creating-a-bridged-network-with-netplan-on-ubuntu-bionic/ KVM: Creating a bridged network with NetPlan on Ubuntu bionic] </li>
<li>[https://wiki.libvirt.org/page/VirtualNetworking VirtualNetworking] </li>
<li>[https://libvirt.org/formatnetwork.html Network XML format] </li>
<li>[https://amoldighe.github.io/2017/12/20/kvm-networking/ KVM Networking - NAT & Host-Only] </li>
<li>[https://www.pitt-pladdy.com/blog/_20150620-151456_0100_Home_Lab_Project_Network_Bridges_for_KVM_-_NAT_Host-only_Isolated/ Home Lab Project: Network Bridges for KVM - NAT, Host-only, Isolated] </li>
</ul>
</li>


= Back and restore images =
= Back and restore images =

Revision as of 10:53, 26 November 2020

Resource

Install

Install on Ubuntu

Install on CentOS

snapshot

  • How to Create, Revert and Delete KVM Virtual machine (domain) snapshot with virsh command, How to create snapshot in Linux KVM VM/Domain
    $ sudo su
    # virsh list --all
    
    # virsh snapshot-create-as --domain win10 --name win10_snap --description "Windows 10 snapshot"    # Create a snapshot
    # virsh snapshot-list win10
    # virsh snapshot-info --domain win10 --snapshotname win10_snap
    
    # virsh snapshot-revert win10 win10_snap    # Restore
    
    # virsh snapshot-delete --domain win10 --snapshotname win10_snap
    
  • To create a snapshot using the GUI, open virtualization manager window. In the VM properties, click on the icon (two displays overlapped) which is on the right of the menu, which says Manage VM snapshots.

GUI manager

Network

Back and restore images

How to KVM Backup and Restore in Linux

# Backup 
virsh list --all
virsh dumpxml win10 > /MyBackup/win10.xml
sudo cp /var/lib/libvirt/images/win10.qcow2 /MyBackup/win10.qcow2
sudo chown $USER:$USER /MyBackup/*.qcow2

# Restore Making
sudo virsh undefine win10
ls -l /etc/libvirt/qemu
virsh list –all
sudo rm /var/lib/libvirt/images/win10.qcow2
sudo cp /MyBackup/win10.qcow2 /var/lib/libvirt/images/
sudo virsh define --file /MyBackup/win10.xml
# virsh start win10

Cheat sheet

KVM Cheatsheet

Run macOS on KVM / QEMU

How To run macOS on KVM / QEMU