Atom feed of this document
 

 Boot From Volume

The Compute service has preliminary support for booting an instance from a volume.

 Creating a bootable volume

To create a bootable volume, mount the volume to an existing instance, and then build a volume-backed image. Here is an example based on exercises/boot_from_volume.sh. This example assumes that you have a running instance with a 1GB volume mounted at /dev/vdc. These commands will make the mounted volume bootable using a CirrOS image. As root:

# mkfs.ext3 -b 1024 /dev/vdc 1048576
# mkdir /tmp/stage
# mount /dev/vdc /tmp/stage

# cd /tmp
# wget https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-rootfs.img.gz
# gunzip cirros-0.3.0-x86_64-rootfs.img.gz
# mkdir /tmp/cirros
# mount /tmp/cirros-0.3.0-x86_64-rootfs.img /tmp/cirros

# cp -pr /tmp/cirros/* /tmp/stage
# umount /tmp/cirros
# sync
# umount /tmp/stage

Detach the volume once you are done.

 Booting an instance from the volume

To boot a new instance from the volume, use the nova boot command with the --block_device_mapping flag. The output for nova help boot shows the following documentation about this flag:

 --block_device_mapping <dev_name=mapping>
                        Block device mapping in the format <dev_name=<id>:<typ
                        e>:<size(GB)>:<delete_on_terminate>.
 

The command arguments are:

dev_name

A device name where the volume will be attached in the system at /dev/dev_name. This value is typically vda.

id

The ID of the volume to boot from, as shown in the output of nova volume-list.

type

This is either snap, which means that the volume was created from a snapshot, or anything other than snap (a blank string is valid). In the example above, the volume was not created from a snapshot, so we will leave this field blank in our example below.

size (GB)

The size of the volume, in GB. It is safe to leave this blank and have the Compute service infer the size.

delete_on_terminate

A boolean to indicate whether the volume should be deleted when the instance is terminated. True can be specified as True or 1. False can be specified as False or 0.

[Note]Note

Because of bug #1008622, you must specify an image when booting from a volume, even though this image will not be used.

The following example will attempt boot from volume with ID=13, it will not delete on terminate. Replace the --image flag with a valid image on your system, and the --key_name with a valid keypair name:

$ nova boot --image f4addd24-4e8a-46bb-b15d-fae2591f1a35 --flavor 2 --key_name mykey --block_device_mapping vda=13:::0 boot-from-vol-test


loading table of contents...