Creating a downloadable S3 backup

In addition to the automatic backup service, it’s a good idea to periodically create and download a copy of your server’s disks. This can be done using S3 Backups, which can be created in two possible ways:

S3 Backup from the disk list view

The easiest way is to go to the disk list by selecting Resources > Virtual Disks from the left menu, and then click on the create backup button next to the disk you want to backup.

Creating a downloadable S3 backup


To reduce the size of the backup file, you can enable compression on the fly. To do this, select Enabled in the S3 Backup Compression field, then click the Create Backup button.

Creating a downloadable S3 backup

Remember that enabling compression slows down the backup process, but reduces its final size, making it faster to download.

After selecting all the disks you want to create a backup of, you can move on to the Downloading the created backup section.


S3 Backup from the server details view

The second way to create a backup of disks is to go to the server list by selecting the Servers > e24cloud Servers tab from the left menu, and then click on the name of the server that you want to back up. After entering the detailed view of the server, locate the Backups section and click the Create backup button.

Creating an S3 backup that can be downloaded


In the form, first, we need to specify the disks that we want to backup. Additionally, we can enable on-the-fly compression. To do this, select the Enabled option from the S3 backup compression field. Then click the Create backup button.

Creating an S3 backup that can be downloaded

It is worth remembering that enabling compression slows down the backup process, but reduces its final size, and thus speeds up its download.

After specifying all the disks we want to create backups of, we can proceed to the point of Downloading the created backup.


Downloading the created backup

When we have created a backup queue using one of the above-mentioned methods, we can select the Resources > Images and backups tab using the left menu. We will be in a view containing backups of our server disks. If a given backup has a value of 0 in the Image field and there is information about progress next to it, it means that the backup of the given disk is being created.

Creating an S3 backup that can be downloaded


After the backup of a given disk is created, the progress information will disappear, and in the Image field, we can see two possible values:

  • if we did not choose to compress the backup - it will be the same value as the disk size,
  • if we chose to compress the backup - it should be a value smaller than the disk size.

To download a backup copy of the selected disk, click the Download backup button.

Creating a downloadable S3 backup

Remember that the disk image you are downloading is a binary copy.


After clicking the indicated button, a window will appear in which we can choose whether we want to start downloading the backup file immediately to our local computer or we prefer a link that we want to pass as a parameter, e.g. wget. To conveniently copy the link to the clipboard, click the arrow-marked button.

Creating a downloadable S3 backup


Downloading data from a backup file

If a backup of a server running on the Linux operating system has been created, in order to be able to read the contents of the backup, we need to mount our backup in Linux or, in the case of Windows, using e.g. WSL2 by using the command

losetup -f -P /path/to/our/image

The image will be mounted as a virtual device /dev/loopX (depending on how many partitions it has). Then, using the command

fdisk -l /path/to/our/image

we will know the sector size and partition layout in the backup file. Below is an example view from the console when reading a 100GB disk containing one partition.

Creating a downloadable S3 backup


In the next step, we create a directory to which we will mount the virtual device:

mkdir /home/backup

Then, we calculate the offset, which is the beginning of the partition from which we want to read data. In the example above, we see that the disk has 512-byte blocks and the partition starts from sector 63 of the disk. To calculate the offset, we need to multiply both numbers. In our example, it will be 63 * 512 = 32256. To complete the mounting of our disk, we use the command:

mount -o loop,offset=32256 /dev/loop0 /home/backup

where:

  • offset=32256 - is the previously calculated value indicating the start of the partition we are mounting
  • /dev/loop0 - is the proper virtual device from which the data will be read
  • /home/backup - is the directory to which the partition selected by us will be mounted

If everything went well, we should be able to use the command

ls /home/backup

to list the files and directories from the partition mounted from the backup image, and then copy them to the local machine as desired. Remember that the disk image mounted in this way is read-only and cannot be used to save data on it.