Applies To: CLOUD IAAS
The concepts of volumes and images must be understood in order to use OpenStack effectively, with snapshots being a sub-type of images.
The first and most important point regarding volumes and images is their similarities. They are both persistent storage objects backed by distributed and redundant storage arrays, and are equally resilient and dependable.
The differences between them, however, is how they are intended to be used. As with many areas of OpenStack, there are many overlaps in their use cases.
Images and Snapshots
The core idea of an image is that it is a bootable filesystem that contains an Operating System. Images are the basis of instances (a virtual machine in OpenStack terminology). An image can be created from any of the following source files:
- raw - An unstructured disk image format
- iso - An archive format for the data contents of an optical disc (e.g. CDROM).
- qcow - A disk format supported by the QEMU emulator that can expand dynamically and supports Copy on Write.
These operating system images can be created and uploaded from your local computer or directly into the OpenStack deployment from an online source. Images are the primary source of an OS for creating instances (although volumes that contain a bootable filesystem can also be used instead).
When an image is used as the base OS for an instance a new copy is created and employed. The original image is not modified or locked and will not be deleted when the instance is terminated. The image can, therefore, be used for other instances.
Snapshots are instantaneous copies of instances. They contain an image of the state of the filesystem at the moment that the snapshot is taken. A snapshot of an instance can be used as the basis of an instance and booted up at a later time.
A volume is a block of storage device that can be used in a number of ways within OpenStack:
Volumes as a Boot Device
Volumes can be used as the basis of an instance as long as the volume contains a bootable operating system. It simply needs to be selected as the Instance Boot Source when creating a new instance. If a volume is used as the basis of an image then its data will be copied into the instance and the volume will be available to be used for another instance.
Volumes as a Portable Storage Device
Volumes can be attached to instances and will appear as a new block device. In this way, they can be thought of as a spare hard disk that can be attached to instances and used as an independent storage device.
Here is a 5GB volume attached to an instance running Ubuntu. It appears as /dev/sdb prior to being partitioned or mounted:
Here is the same volume after it has been partitioned, formatted and mounted:
A volume can be attached to an instance when it is either running or stopped. If the instance is running the new device will appear immediately and does not require a reboot to be mounted and used.
If a volume is created as "empty" (i.e, it contains no data or filesystem) it can be partitioned and formatted in the normal manner from within a running instance to which it was attached.
Volumes are never permanently attached to an instance. They can be unattached from one instance and attached to another making their data portable between instances.
You will notice when creating a new volume that there is a selectable type parameter with the options being; StandardDisk, HighIOPS, HighBandwidth and HighPerformance. This type parameter represents a collection of variables modifying a volumes performance. If this option is left as 'no volume type' it will default to StandardDisk.