Boot from a Block Storage volume
The Block Storage service lets you attach additional storage volumes to your Compute Instances. In addition to storing files and media, you can also use a volume as a boot disk. This can provide a low-cost way to maintain an image that can be quickly attached to a Compute Instance and booted up when needed.
This guide outlines the steps needed to boot your Compute Instance from a Block Storage volume. These steps include creating a new volume, copying the primary disk to that new volume, and configuring the Compute Instance to boot from that volume. The process may be reversed in order to restore the primary disk from the volume.
Create the volume
Create a Block Storage volume and attach it to the desired target Compute Instance. Verify that the volume is the same size as (or larger than) the primary disk and is in the same data center as the Compute Instance. Review the View, create, and delete volumes for instructions on creating a new volume.
Copy the primary disk onto the volume
-
Boot the Compute Instance into Rescue Mode and assign the volume to
/dev/sdc
(shown below). The primary disk should remain assigned to/dev/sda
. If your device assignments are different, you may need to adjust the commands or steps in this guide accordingly. Review the Rescue and rebuild guide for more information on booting into Rescue Mode. -
Connect to the Compute Instance via Lish.
-
Run
fdisk -l
to confirm the Compute Instance's primary disk and Block Storage volume are available asdev/sda
anddev/sdc
, respectively. -
Run the following
pv
command to copy the contents of the primary disk to the Block Storage volume. Respectively, the options-pte
output a progress meter, the elapsed time, and the estimated time remaining.pv -pte < /dev/sda > /dev/sdc
Set the Block Storage volume as the primary disk and reboot
-
Power off the Compute Instance.
-
Edit the Compute Instance's Configuration Profile. Under the Block Device Assignments section, assign the
/dev/sda
device to your Block Storage volume (shown below). Confirm that the root device is set to/dev/sda
(this is the default setting). If your volume was previously assigned to any other device, such as/dev/sdc
, set the device toNone
. Save these changes. Review the Manage configuration profiles on a Compute Instance guide for more information on editing configuration profiles. -
Power on the Compute Instance.
The Compute Instance should boot normally from the Block Storage volume. Keep in mind that Block Storage may not be as fast as the Compute Instance's local storage and, as such, performance may be different.
Updated about 1 month ago