38,939
edits
(Updating to match new version of source page) |
(Updating to match new version of source page) |
||
Line 105: | Line 105: | ||
=Working with images= | =Working with images= | ||
Images are files which contain the contents of a virtual disk. Often Images contain a base operating system used to create an initial volume or ephemeral disk from which a virtual machine boots. An ephemeral disk is a virtual disk file which resides on the host (or hypervisor) where the virtual machine runs. Ephemeral disk files are destroyed when a VM is destroyed, in contrast to [[OpenStack#Working with Volumes|volumes]]. Images are portable in that they can be download from the cloud, used to create a virtual machine using virtual box or similar on your laptop, and uploaded to another cloud and used to create a new virtual machine. This is not the case with volumes or ephemeral disks. Images come in a variety of formats. Some commonly encountered formats are, raw, qcow2, vmdk, and vdi. | |||
If sharing your virtual machine images be sure to remove sensitive information such as public/private keys, configuration files containing passwords etc. If uploading images created from a virtual box virtual machine to be used on many cloud platforms (including OpenStack) it must have cloud-init installed and configured correctly to work within the cloud (see openstack docs on [https://docs.openstack.org/image-guide/create-images-manually.html creating images mannually] for more details and examples on a few common operating systems). | |||
For a list of images provided by staff on Compute Canada clouds see [[Cloud resources#Images| images]]. | |||
==Creating an Image from a VM== | ==Creating an Image from a VM== | ||
The | The procedure for creating an image of a VM depends on whether it is booting from a volume (typically "p" flavors), or from an ephemeral disk (typically "c" flavors). | ||
===If booting from an ephemeral disk=== | ===If booting from an ephemeral disk=== | ||
the [[OpenStack Command Line Clients]] can be used with the command: | the [[OpenStack Command Line Clients]] can be used with the command: | ||
{{Command| openstack server image create <server-name>}} | {{Command| openstack server image create <server-name>}} | ||
where <code><server-name></code> should be replaced with the name of your server. This action will only include the VM's root drive (e.g. /dev/vda) in the image. Ephemeral drives and non-boot attached volumes will not be included in the image so additional measures should be taken to preserve this data. In addition, if the VM is writing to disk while the image is being created the | where <code><server-name></code> should be replaced with the name of your server. This action will only include the VM's root drive (e.g. /dev/vda) in the image. Ephemeral drives and non-boot attached volumes will not be included in the image so additional measures should be taken to preserve this data. In addition, if the VM is writing to disk while the image is being created the filesystem may be captured in an inconsistent state. We recommend the VM be shut off (not deleted) before an image is created from it. | ||
===If booting from a volume=== | ===If booting from a volume=== | ||
Line 217: | Line 224: | ||
===c flavors=== | ===c flavors=== | ||
"c" flavors often have extra ephemeral drives, which will be resized when you choose a new "c" flavor. These ephemeral drives can not become smaller, and as such "c" flavor VMs can only be resized to flavors with equal or larger ephemeral drives. After the resize however, you will not immediately see a larger ephemeral drive within your VM (e.g. the [https://en.wikipedia.org/wiki/Df_(Unix) <code>df -h</code>] command will not show the size increase). To see this extra space you will need to resize your | "c" flavors often have extra ephemeral drives, which will be resized when you choose a new "c" flavor. These ephemeral drives can not become smaller, and as such "c" flavor VMs can only be resized to flavors with equal or larger ephemeral drives. After the resize however, you will not immediately see a larger ephemeral drive within your VM (e.g. the [https://en.wikipedia.org/wiki/Df_(Unix) <code>df -h</code>] command will not show the size increase). To see this extra space you will need to resize your filesystem (see the [https://linux.die.net/man/8/resize2fs <code>resize2fs</code>] command). However, filesystem resizes should be treated with caution and can take considerable time if the partitions are large. Before resizing a filesystem it is recommend to create backups of its contents (see [[backing up your VM]]). | ||
===p flavors=== | ===p flavors=== |