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...")
 
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:

Revision as of 18:25, 28 March 2021

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>

Verify that the memory change took:

virsh dominfo <guest-name>