Understanding the Difference between Backups and Snapshots on Alibaba Cloud

Image for post
Image for post

As the person responsible for one or more servers, one of your most important tasks is to design and implement an effective backup strategy. Having recent, reliable backups guarantees your ability to recover from a whole host of events that would otherwise spell disaster for the server and possibly your entire business. Such events include a ransomware or virus attack, a serious system crash, data corruption caused by hackers, or a mistake made by a system administrator such as inadvertently formatting the wrong disk.

When you’re working with servers on Alibaba Cloud, and indeed with any other cloud provider too, you will notice that you are often provided with a choice between taking a backup or a snapshot. While backups and snapshots are similar, they should not be considered as interchangeable.

Backups

A conventional backup comprises a copy of one or more files. Those files might be users’ documents on a file server, HTML or PHP files on a web server, email messages on a mail server, and so on. To create file-level backups on an ECS server from Alibaba Cloud, you can use the Hybrid Backup Recovery application (HBR) that is available from the management console and lets you create a cloud-based vault in which to safely create and store a backup until it is required. For added security and resilience, this can back up to multiple Alibaba Cloud geographic regions. Everything happens very quickly, because backups take place across Alibaba Cloud’s own internal network.

An HBR backup plan allows you to specify which files and directories get included and excluded, how often the backup job should run, and how long to store the backup before it is automatically deleted. You can also start a backup job manually on demand whenever you wish. Restoring one or more files from a backup can be performed quickly and easily from the web-based management console by anyone who is authorised to use it.

Backing up conventional files such as documents and programs is pretty straightforward. In the case of databases, however, some additional consideration is required. Even though databases are stored on disk as conventional files, you can’t simply back up those files like any others because you can’t be confident that they are in a stable state. The Hybrid Cloud Recovery solutions takes care of this automatically, and can thus be used to back up and restore databases such as SQL Server, MySQL and Oracle.

It’s important to remember that file-level backups are designed to protect you from incidents (malicious or accidental) that affect one or more files, rather than the entire integrity and stability of the server as a whole. Even if you back up the entire file system, including all of the operating system files, you will still not be able to restore the entire server in the event of a disaster such as a corrupted boot record. Or indeed from any other event which is sufficiently serious to prohibit you from gaining access to the server in order to run the restore process. For such cases, a snapshot is a better option.

If you do wish to create a backup of an entire server, you can install and use a third party backup utility. One leading product is Veeam Backup. As of version 9.5 Update 4, Veeam now fully supports Alibaba Cloud’s Object Storage Service (OSS), which allows for unlimited amounts of data stored in cloud-based vaults. This can be used to create partial or full backups of servers both cloud-based and on-premises.

Snapshots

A snapshot is a complete copy of a server or disk at a particular point in time. You don’t get to choose which files get copied because the snapshot includes every file, the contents of RAM, any background services that were running, and the entire state of the server. Restoring a snapshot will revert the server to precisely the state it was in when the snapshot was taken.

Taking a snapshot of an Alibaba Cloud ECS server is simple and can be performed from within the web based management console by anyone who has permission to do so. You can specify how long to keep the snapshot for, and you can optionally encrypt it if required.

When you first create an Elastic Compute Service server, you can also configure the system to take a snapshot automatically. When enabled, the default policy is to create one snapshot each day at 5am, 7 days a week, and keep it for 7 days. You can change this if you wish, creating up to 24 snapshots a day (1 per hour) and keeping them for up to 65535 days. Up to 1000 automatically created snapshots can exist for each disk, after which the earliest one will be overwritten.

You can even create a custom image from a snapshot, which provides an ideal mechanism for rolling out multiple copies of a server once you have spent time developing and testing a particular configuration.

Snapshot Suitability

It may at first seem that snapshots are similar to backups, but they are designed to serve very different purposes and should not generally be used in place of backups.

Snapshots can’t be copied to multiple geographic regions, so they don’t provide the same degree of resilience and protection as a conventional backup. Also, it’s not possible to verify a snapshot.

Snapshots are best used on development or test servers rather than production machines, because the facilities they provide will typically be of most use in such environments. For example, if you want to test a new security patch or a new OS build, or perhaps a data migration task, take a snapshot before you start. If everything goes as expected, delete the snapshot after a few days. If problems are discovered, simply roll back the server to the state contained in the snapshot and your test server will be back to normal with no need to rebuild it. You can then modify your procedure slightly and try again, repeating the process as many times as it takes to get it right.

Snapshotting Running Instances

You can take a snapshot of an ECS instance at any time, regardless of whether the server instance is running or stopped. However, a running instance may be performing many background tasks, including complex database transactions. Or it may be part of a server farm, sharing its duties with other closely-coupled machines in order to provide fault tolerance or increased processing capacity. Therefore, snapshotting a running instance may require some careful consideration in order that you can be confident that the server can be successfully rolled back if required, without affecting other parts of the system as a whole.

In environments where a single server provides just a single function, such as running a web server without a locally-installed database engine, creating a snapshot of a running instance is likely to be perfectly safe and will provide a similar degree of functionality to a conventional backup. In other circumstances, it may be preferable to stop and shut down the server before taking a snapshot, for more predictable results when the server is reverted.

Keeping Costs Down

To keep costs down, delete backups and snapshots that are no longer required in order to avoid unexpected monthly storage charges. HBR allows you to specify the retention period of the backup, with the default being around 2 years (730 days to be precise). You can change this to your liking. However, avoid making this period too short, or keeping too few generations of backup available, in order to maximise your ability to restore to a specific point in time. You can also delete backups manually on demand whenever you wish.

HBR uses what’s known as an incremental backup mechanism in order to keep backup sizes, and thus your costs, to a minimum. If you back up a folder twice, the second backup will only contain those files which changed after the first backup was created. Any files which are unchanged will not be backed up a second time. This is known as an incremental backup.

Because snapshots contain an entire copy of a server including all its files and RAM contents, snapshots are generally larger than backups.

In Summary

Backing up your cloud servers is vitally important, and Alibaba Cloud makes this easy. To back up one or more files or folders, use HBR. You can also create snapshots, but these should not be regarded as conventional backups except in specific circumstances.

If you don’t already have an Alibaba Cloud account you can create one for free at https://www.alibabacloud.com/

Original Source:

Written by

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store