Backup and Restore Partitions (Block Storage)
Table of Contents
This page contains instructions on how to backup, restore and encrypt partitions (or block storage). But before we look at these details, let’s consider the difference between Elastio block and EBS backups and restores.
Note: The difference between an Elastio block and an Elastio EBS backup can be found here.
Backup and restore detail
Backup
Note: Block backups on Linux-based systems are partition-level backups. The partition being backed up must have at least 10% free space for change block tracking. If the available space is less than 10% (for instance: 6%), you can use Elastio file backups instead.
To change the preallocated COW (Copy-on-Write) file size as a percentage, edit the allocated_space variable in the /etc/elastio/elastio-snap.toml file as follows:
nano /etc/elastio/elastio-snap.toml
The value 0 means default value. Add the percent as a number (1 for 1%, 5 for 5%, and so on). The maximum allowed value is 50 for 50%. There isn’t a specific minimum percentage - it can be less than 10%. However, it depends on the volume size and the number of changes between snapshots. Therefore, the backup might hang or fail if the snapshots differ a lot, the volume size is small, and the COW file percentage is set to 1%.
Backups and restores are supported for all partitions, both boot and non-boot partitions. For boot partitions, you can recover the partition, but booting from it is not supported. It may be possible for us to support booting from a block backup of a boot partition in the future.
Note: Block backups should not be used to backup disks that are mounted write. Read-only mounts are fine. Attempting a block backup of a disk that is mounted write will return an error.
Use the command lsblk
to list all available block devices. Here is an example of the command and resulting output:
ubuntu@ip-172-31-30-130:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 33.3M 1 loop /snap/amazon-ssm-agent/3552
loop1 7:1 0 70.4M 1 loop /snap/lxd/19647
loop2 7:2 0 55.5M 1 loop /snap/core18/1997
loop3 7:3 0 32.3M 1 loop /snap/snapd/11588
loop4 7:4 0 32.3M 1 loop /snap/snapd/12883
loop5 7:5 0 55.4M 1 loop /snap/core18/2128
loop6 7:6 0 25M 1 loop /snap/amazon-ssm-agent/4046
loop7 7:7 0 70.3M 1 loop /snap/lxd/21029
nvme1n1 259:0 0 69.9G 0 disk
nvme0n1 259:1 0 8G 0 disk
└─nvme0n1p1 259:2 0 8G 0 part /
From the output above, select the partition that you want to back up. For instance, we want to back up the partition named nvme0n1p1
. Therefore, the command we use to back up this partition is as follows:
sudo -E elastio block backup <partition-name>
Use this command to back up your chosen partition by replacing the partition name and path /dev/nvme0n1p1
with the new partition’s name.
Any block recovery point can be checked for filesystem integrity with Elastio CLI. this check can either be initiated right after the backup is taken by adding a --fs-check
flag to the backup command like so:
sudo -E elastio block backup <partition-name> --fs-check
or by separately launching this operation with the following command:
elastio fs-check --rp <elastio-rp-id>
Restore
When running the block restore operation, you need to add sudo -E
in front of the command. And for RHEL, Fedora, and CentOs, you must add sudo -E --preserve-env=HOME
to the beginning of the block restore instruction.
An example of the block restore command for Ubuntu is as follows:
sudo -E elastio block restore --rp r-df5tyc0gapo2r7p644cmewme /dev/nvme1n1p1:/dev/nvme4n1p2
An example of the block restore instruction for Fedora is as follows:
sudo -E --preserve-env=HOME elastio block restore --rp r-df5tyc0gapo2r7p644cmewme /dev/nvme1n1p1:/dev/nvme4n1p2
List the available recovery points
The elastio rp list
command is used to list all of the available recovery points (or backups). It can be used “as is,” or with the following options to filter the output.
Return a list of available recovery points by asset type:
elastio rp list --<asset-type>
Return a list of available recovery points by asset ID:
elastio rp list --<asset-type> <asset-id>
Return a list of available recovery points by backup type:
elastio rp list --<asset type> <asset-id> --type <backup type>
Run the following commands to list the recovery points made from the current instance:
elastio rp list --self
elastio rp list --ec2 <aws-ec2-instance-id>
or host:
elastio rp list --self
elastio rp list --host <hostname>
Note: EBS backups are not listed using --self
. Run the following command to return all the EBS backups:
elastio rp list --ebs
Additionally, the --type
option will accept any backup type available for a specific asset type. For example:
elastio rp list [--ec2 <aws-ec2-instance-id> | --host <hostname>] --type file
Use the following command to return all the recovery points of a certain type that belong to a specific instance:
elastio rp list --ec2 <aws-ec2-instance-id> --type file