User Tools

Site Tools


unix:virtualization:virtlib:quickreference

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
unix:virtualization:virtlib:quickreference [2022/07/23 01:26] rodolicounix:virtualization:virtlib:quickreference [2025/07/27 16:34] (current) rodolico
Line 1: Line 1:
 ====== virt-lib Quick Reference ====== ====== virt-lib Quick Reference ======
 +
 +virtlib stores its configuration for each //domain// (virtual) in /etc/libvirt/qemu*.xml. You should not manually modify anything in this directory, but you can safely do any read-only operation. To edit/export/whatever, the //virsh// command has several options that will help you out.
 +
 +The xml files are, well, xml. The format is documented at https://libvirt.org/formatdomain.html which is guaranteed to either help you, or put you to sleep.
  
 ===== virt-top ===== ===== virt-top =====
Line 28: Line 32:
       * This will attach a new bridge to domain //domain//, using //bridge// defined on hypervisor, called vnet3 on the virtual, with the mac address set to whatever you use.       * This will attach a new bridge to domain //domain//, using //bridge// defined on hypervisor, called vnet3 on the virtual, with the mac address set to whatever you use.
     * detach-interface //domain// --type bridge --mac 00:16:3e:xx:xx:xx --config     * detach-interface //domain// --type bridge --mac 00:16:3e:xx:xx:xx --config
 +  * Attach/Detach Block Device
 +    * <code bash>virsh detach-disk router sda --config
 +    * <code bash>virsh attach-disk router /dev/vg/lvname sda --config --targetbus=virtio
   * Remove virtual image (config file only)<code bash> virsh undefine domainname</code>   * Remove virtual image (config file only)<code bash> virsh undefine domainname</code>
   * **change-media //name// //drive//** - Insert or Eject a CDROM   * **change-media //name// //drive//** - Insert or Eject a CDROM
-    * change-media //name// //drive// --eject +    * <code bash>virsh change-media domainname driveletter --eject</code> 
-    * change-media //name// //drive// //path/to/image// --insert+    * <code bash>virsh change-media domainname driveletter /path/to/image/ --insert</code> 
 +  * Rename Domain 
 +    * <code bash>virsh shutdown domainname ; virsh domrename domainname newname ; virsh start newname</code>
  
 ==== Boot from CD ROM ==== ==== Boot from CD ROM ====
Line 268: Line 277:
  
 You can now do things like <code bash>ifconfig dom113</code> or <code bash>ip a show dom113</code> You can now do things like <code bash>ifconfig dom113</code> or <code bash>ip a show dom113</code>
 +
 +===== Adding USB Drive Image =====
 +
 +Building and using a USB Thumbdrive image is a little weird, but it can be done. See [[software:multibootusb|]] for an example of one way I did it.
  
 ===== Links ===== ===== Links =====
unix/virtualization/virtlib/quickreference.1658557566.txt.gz · Last modified: 2022/07/23 01:26 by rodolico