Linux Virtualization Remove Storage from Guest: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * Linux Virtualization Operations =Procedure= Shut down the guest: <syntaxhighlight lang='bash'> virsh shutd...")
 
 
(One intermediate revision by the same user not shown)
Line 15: Line 15:
</syntaxhighlight>
</syntaxhighlight>


Lookup the memory definition line:
Lookup the device definition and remove it:
<syntaxhighlight lang='xml'>
<syntaxhighlight lang='xml'>
<memory unit='KiB'>16777216</memory>
...
<devices>
  ...
  <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/iso-images/CentOS-7-x86_64-DVD-7.9.2009.iso'/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
  </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
</syntaxhighlight>
</syntaxhighlight>
Edit to the desired value (note that the memory is expressed in KiB)
Delete <currentMemory>


Restart the guest:
Restart the guest:
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
virsh start <guest-name>
virsh start <guest-name>
</syntaxhighlight>
Verify that the memory change took:
<syntaxhighlight lang='bash'>
virsh dominfo <guest-name>
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 01:37, 30 July 2023

Internal

Procedure

Shut down the guest:

virsh shutdown <guest-name>

Edit the guest definition:

virsh edit <guest-name>

Lookup the device definition and remove it:

...
<devices>
  ...
  <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/iso-images/CentOS-7-x86_64-DVD-7.9.2009.iso'/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
  </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>

Restart the guest:

virsh start <guest-name>