Link Search Menu Expand Document

Backup and Restore EBS Volumes

Table of Contents

This page contains instructions on how to backup, restore,encrypt and shrink EBS volumes. But before we look at these details, let’s consider the difference between Elastio block and EBS backups and restores and running EBS backup and restores as background jobs.

Note: The difference between an Elastio block and an Elastio EBS backup can be found here.

Run EBS backups

EBS backups are by default agentless, which means that Elastio provisions a dedicated host instance to perform the operation. As soon as the backup is completed, this instance is automatically scaled down. This allows jobs to run in the background while other processes continue.

Examples

Here is an example of the backup command that will be executed in the background with monitoring on:

elastio ebs backup --volume-id i-fdsdfdsf324324 --monitor

Here is an example of the backup command that will be executed in the background without monitoring on:

elastio ebs backup --volume-id i-fdsdfdsf324324

Even without the monitoring option, once the background job has started, you can still monitor it with the elastio job monitor command provided in the output.

Import EBS snapshots

Import Snapshot functionality provided by Elastio gives you an option to save some or all available EBS snapshots in your AWS account to your Elastio vault, where they are stored compressed and deduplicated. A recovery point will be created for every snapshot and when you need to create a volume from it, you can use elastio ebs restore. Each snapshot can only be imported into an Elastio vault once, so as a result when a subsequent backup on the said snapshot is initiated to the same vault the operation will return the initial recovery point ID and no additional work will be done. However, if you need to import the same snapshot into another vault, you can do so without restrictions.

Examples

Here is an example of the import snapshot command for a certain snapshot with monitoring on:

elastio ebs import-snapshot --snapshot-id <snapshot-id> --monitor

The following example shows the import of the latest snapshot for a certain EBS volume with monitoring on:

elastio ebs import-snapshot --volume-id <volume-id> --monitor

Please note: Only one snapshot / volume ID can be passed into this command for the time being.

Run EBS restores

The restore functionality is, in essence, identical to the backup-as-background job and is the default. An agent instance will spin out, taking care of the restore.

The Elastio CLI can run on any machine, localhost or instance of any type. An example command of how to instantiate an EBS restore is as follows:

elastio ebs restore --rp <rp-ref> --monitor

Foreground EBS Backups and Restores

For foreground EC2 backups and restores, use a Nitro instance to install and run the Elastio CLI on an AWS EC2 instance. It is optimized for fast EC2 backups. Consequently, running EC2 backups or restores on another instance-type might result in an error.

Backup an EBS volume in foreground

Use the following command to back up an EBS volume:

sudo -E elastio ebs backup [FLAGS] [OPTIONS] --volume-id <volume id> --foreground

Here is a practical example of what this command must look like:

sudo -E elastio ebs backup --volume-id vol-0bb3a7dcee068fd72 --foreground

Restore an EBS volume in foreground

The following commands are needed when restoring an EBS volume, from selecting a recovery point to starting the restore operation:

Use the following command to return a list of available recovery points by asset type:

elastio rp list --ebs

Use the following command to pick a recovery point from this list and start the restore:

sudo -E elastio ebs restore --rp <rp-id> --foreground

Here is a practical example of what the EBS restore command should look like:

sudo -E elastio ebs restore --rp r-1234567654322345 --foreground

Encrypt an EBS volume

By default, Elastio restores EBS volumes to represent the same state that they were in at the time of backup: Encrypted as encrypted and unencrypted as unencrypted. Elastio now provides a way to override this default.

The following commands describe how to restore an EBS volume “as is” at backup and how to change its encryption status:

Use the following command to restore an EBS volume that was encrypted as encrypted (no additional flags are required):

sudo -E elastio ebs restore --rp <rp-id>

Use the following command to restore an EBS volume that was unencrypted as unencrypted (no additional flags are required):

sudo -E elastio ebs restore --rp <rp-id>

Use the following command to restore an encrypted EBS volume as encrypted and encrypt it with the default AWS managed key:

sudo -E elastio ebs restore ---rp <rp-id> --encryption apply

Use the following command to restore an encrypted EBS volume as encrypted and encrypt it with another key:

sudo -E elastio ebs restore --rp <rp-id> --encryption apply --kms-key <kms-key-id>

Use the following command to restore an EBS volume that was not encrypted on backup and encrypt it with the default AWS managed key:

sudo -E elastio ebs restore ---rp <rp-id> --encryption apply

Use the following command to restore an EBS volume that was not encrypted on backup and encrypt it with another key:

sudo -E elastio ebs restore --rp <rp-id> --encryption apply --kms-key <kms-key-id>

Use the following command to restore an EBS volume that was encrypted on backup as unencrypted:

sudo -E elastio ebs restore --rp <rp-id> encryption disable

Shrink an EBS volume

Shrinking is the process of reducing the size of the partition to create unallocated space. Before an instance can use the space on the disk to store data, the disk needs to be split up into separate areas called partitions.

The Elastio CLI can run EBS volume shrink on any machine, localhost or instance of any type as a background job. The operation starts with selecting and analyzing a recovery point and completes with creation of a new EBS volume of the new target size. All modifications to the disk performed by the shrink operation will be in the sparse file on the disk. Consequently, it requires that sparse file is on a partition with enough space for all of the writes to be performed on the filesystem as part of the shrink operation.

To shrink a partition, define the target size of the EBS volume.

  1. You may request a target size (which may or may not be possible to achieve).

  2. You may request the smallest possible size.

  3. You may request the smallest possible size + some fixed number of free megabytes to support additional work.

Use the following command to restore the EBS volume to the target size:

elastio ebs restore --rp <rp-id> --shrink "len 100GiB"

To request the smallest possible size, the following command is needed:

elastio ebs restore --rp <rp> --shrink max

Use the following command to request the smallest possible size + some fixed number of free megabytes to support additional work.

elastio ebs restore --rp <rp-id> --shrink "leave 42GB"

The supported file systems are NTFS, Ext2/Ext3/Ext4 and XFS.