create vms linux commands

I have been digging deeper into XenServer and found why ittakes such a long time to create VMs from templates. It is because by defaultthe Local storage is of block type storage. As a result a 20 GB VM needs toreserve the complete 20GB of the VM. We can make the machine creation faster ifthe VM does not reserve this complete space at the time of creation. To achievethis we need to convert our storage to file-type storage. Follow these steps toachieve file-type storage (Make sure you back-up all yourVMs before you do this as it will format your local storage.):


At the xsconsole type

# cat/etc/xensource-inventory

Find theDEFAULT_SR_PHYSDEVS= line in the displayed file and make a note of its currentsetting. In a single disk system this should be /dev/sda3


Enter the following command todetermine the UUID for your default SR:

# xe sr-list type=lvm

Make a note of the default UUID.


Determine the UUID for your defaultSR's physical block device (PBD) using the following command:

# xe pbd-list sr-uuid=your SR UUID

Make a note of the PBD UUID.


Disconnect the default SR using thefollowing command:

# xe pbd-unplug uuid=your PBD UUID


Remove the default SR using thefollowing command:

# xe sr-destroy uuid=your SR UUID


Create a new VHD-backed SR using thefollowing command:

# xe sr-createcontent-type="local SR" host-uuid=(press tab because you have asingle host) type=ext device-config:device=YOURDEVICE shared=false name-label="Local File SR"

(replace ‘YOUR DEVICE’with ‘/dev/sda3’ or whatever you get in step 1.)


Enter the following command to set yourSR as the default SR on the system (Or you can set it as default SR using theXenCenter GUI):

# xe pool-param-set default-SR=YOURNEW SR UUID  uuid=(press tab because you have a single pool)


Enter the following command to set yourSR as the default location for suspended VM images:

# xe pool-param-setsuspend-image-SR= YOUR NEW SR UUID  uuid=(press tab because you have asingle pool)


Thenew storage repository is now ready to use. Now your VMs will be created in amatter of seconds. Hope this helps.

你可能感兴趣的:(machine,because,Creation,reserve)