Before starting to understand about different disk types and the difference between root disk vs ephemeral disk in OpenStack, you must understand what are Flavors and how to create a flavor.

What is the difference between root disk vs ephemeral disk in OpenStack

Below list of flavors exist on my undercloud node in OpenStack

$ openstack flavor list
+--------------------------------------+---------------+------+------+-----------+-------+-----------+
| ID                                   | Name          |  RAM | Disk | Ephemeral | VCPUs | Is Public |
+--------------------------------------+---------------+------+------+-----------+-------+-----------+
| 3cd8285a-7f9a-4176-91c5-6cc8d4b69d10 | compute       | 4096 |   20 |         0 |     1 | True      |
| 48c4e5fc-dba5-49e9-98a8-8fca11db781a | control       | 4096 |   20 |         0 |     1 | True      |
| c238e44a-d74e-4d08-91ae-33effb657005 | baremetal     | 4096 |   40 |         0 |     1 | True      |
| e3e95dfd-8a64-4cc0-a57f-bd8a133f5673 | block-storage | 4096 |   40 |         0 |     1 | True      |
| f95ea5d8-d776-4359-96ae-c5a099ddbdc1 | ceph-storage  | 4096 |   15 |         0 |     1 | True      |
| fd31fb4f-0ae5-47ce-a68f-3e5f412b503c | swift-storage | 4096 |   40 |         0 |     1 | True      |
+--------------------------------------+---------------+------+------+-----------+-------+-----------+

 

OpenStack recognises two types of storage: ephemeral and persistent.

Ephemeral storage is storage that is associated only to a specific Compute instance. Once that instance is terminated, so is its ephemeral storage. This type of storage is useful for basic runtime requirements, such as storing the instance’s operating system.

Persistent storage, on the other hand, is designed to survive (“persist”) independent of any running instance. This storage is used for any data that needs to be reused, either by different instances or beyond the life of a specific instance.

 

Each instance needs at least one root disk (that contains the bootloader and core operating system files), and may have optional ephemeral disk. The content for the root disk either comes from an image stored within the Glance repository (and copied to storage attached to the destination hypervisor) or from a persistent block storage volume (via Cinder).

 

Difference between Root Disk vs Ephemeral Disk in OpenStack

Root Disk:

  • The root disk contains the operating system for the image, and it is created using an image as a template.
  • If the size of the root disk is smaller than the minimum disk defined by the image, the instance is not deployed.
  • The OpenStack compute service supports the use of root disks based on OpenStack volumes in order to make root disks persistent.

 

Ephemeral Disk:

  • The ephemeral disk in a flavor defines how much additional disk space is going to be available to the instance.
  • To make this space available, a device is created in the instance.
  • The size of that device is the size defined for the ephemeral disk in the flavor.
  • This device is a raw device, so it needs to be partitioned and formatted with a file system.
  • By default, the size of an ephemeral disk in a flavor is 0 GB.

 

How to create a flavor with root disk and ephemeral disk?

Here below I am creating a flavor m1.exercise with 10 GB root disk and 2 GB Ephemeral Disk

$ openstack flavor create --vcpus 1 --ram 1024 --disk 10 --ephemeral 2 --swap 1024 m1.exercise
+----------------------------+--------------------------------------+
| Field                      | Value                                |
+----------------------------+--------------------------------------+
| OS-FLV-DISABLED:disabled   | False                                |
| OS-FLV-EXT-DATA:ephemeral  | 2                                    |
| disk                       | 10                                   |
| id                         | c8be1fd2-c3e5-4cc4-b6ec-c61a6f544f8c |
| name                       | m1.exercise                          |
| os-flavor-access:is_public | True                                 |
| properties                 |                                      |
| ram                        | 1024                                 |
| rxtx_factor                | 1.0                                  |
| swap                       | 1024                                 |
| vcpus                      | 1                                    |
+----------------------------+--------------------------------------+

 

Lastly I hope the this article on difference between root disk vs ephemeral disk in OpenStack was helpful. So, let me know your suggestions and feedback using the comment section.

 

Leave a Reply

Your email address will not be published. Required fields are marked *