Difference between revisions of "Sysadmin/Add resources to a VM"

From Sugar Labs
Jump to navigation Jump to search
(Created page with '{{Admon/important | This is a work in progress}} === Adding memory to a VM === Shutdown the VM sudo virsh shutdown "name_of_vm" Edit the configuration of the VM sudo virsh...')
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Admon/important | This is a work in progress}}
+
=== Hot-adding a virtio volume to a running VM ===
 +
virsh vol-create-as housetree jita-srv 20G
 +
virsh attach-disk  jita /dev/housetree/jita-srv vdb
  
 
=== Adding memory to a VM ===
 
=== Adding memory to a VM ===
Line 19: Line 21:
 
  sudo virsh start "name_of_vm"
 
  sudo virsh start "name_of_vm"
  
=== Adding disk space to a VM (file based VM)
+
=== Extending the disk file of a VM ===
  
 
Create a file containing the amount of space you want to add to the VM
 
Create a file containing the amount of space you want to add to the VM
Line 36: Line 38:
  
 
  sudo cat additional.raw >> "name_of_vm".raw
 
  sudo cat additional.raw >> "name_of_vm".raw
 
 
 
Page created by Steven M. Parrish
 
 
Any questions find me on IRC in #sugar on freenode
 

Revision as of 12:21, 14 April 2012

Hot-adding a virtio volume to a running VM

virsh vol-create-as housetree jita-srv 20G
virsh attach-disk  jita /dev/housetree/jita-srv vdb

Adding memory to a VM

Shutdown the VM

sudo virsh shutdown "name_of_vm"

Edit the configuration of the VM

sudo virsh edit "name_of_vm"
...
  <memory>XXXXXX</memory>    <--- XXXXXX is (number of gigabytes of memory * 1024 * 1024)
  <currentMemory>XXXXXX</currentMemory>    <--- XXXXXX Should be the same as the previous line

Start the VM

sudo virsh start "name_of_vm"

Extending the disk file of a VM

Create a file containing the amount of space you want to add to the VM

sudo qemu-img create -f raw additional.raw <size>

Shutdown the VM ----- DO NOT SKIP THIS STEP. YOU WILL CORRUPT THE VM IF YOU DO THIS WHILE IT IS RUNNING

sudo virsh shutdown "name_of_vm"

Convert the VM to raw if needed

sudo qemu-img convert -f "name_of_vm".qcow2 -O raw "name_of_vm".raw

Add the additional space to the VM

sudo cat additional.raw >> "name_of_vm".raw