Configure Backup

In this guide we will add a dedicated storage device or partition to an existing Stabile installation for backup of images, so you should have completed these two guides. In environments running virtual servers from virtual images, the backup of images has always been a sore spot, because of the simple fact that we are dealing with very large files that are constantly written to. There are no easy fixes for this situation, short of giving up the advantages of using images.

The preferred and recomended way of backing up images in Stabile is via ZFS snapshots. This requires adding a dedicated storage device of partition to your Stabile environment. There are no special requirements to the device – it could e.g. be a single, large HDD or storage array connected via e.g. eSATA or iSCSI.

Objectives

  • Add a storage device or partition to an existing Stabile installation for backing up images

Prerequisites

  • A Stabile installation with a dedicated storage device or partition for images (as configured in this guide)
  • An available storage device or partition, witout any data you want to keep

Recomendations

  • Preferably use a dedicated HDD of 1 TB or larger

Options

You can add dedicated backup storage to Stabile in two ways. Either way, please note that any existing data will be lost.

  1. Using an entire device
  2. Using an existing partition

1) Use an entire device

  1. Shut down your engine and attach the device.
  2. Power your engine back on. If you are using a previously used device, wipe the partition table.
    • If the device is attached as /dev/sdb, this can e.g. be achieved by typing: wipefs -a /dev/sdb
    • Again – this will wipe all data from the device, so please don’t do this if there is any data on the device you wish to keep.
  3. Reload the web client, i.e. click “reload” in your browser.
  4. In the dashboard tab, locate the “Backup storage” drop-down menu, select your device and click “Format this device”.

2) Use an existing partition

  1. In the dashboard tab, locate the “Backup storage” drop-down menu, select your partition and click “Format this device”.

Verify your new configuration

To verify your new backup configuration, go to the “Images” tab. If you have configured a storage pool with ZFS and completed either 1) or 2) of the above, you should now have a new button in the “Images” tab labeled “Backup now”. In order to test ZFS backup, you should now make sure that you actually have one or more images stored on a ZFS storage pool. This can be done by:

  1. In the “Images” tab select “All” from the “Show” drop-down
  2. Click the “clone” button in e.g. the group of action buttons for e.g. “Codiad Web IDE”
    • The clone of the selected master image will be placed on your default ZFS storage pool
  3. Click “Backup now”
    • Shortly (depending on how many and how big images you have) after clicking this button, you should receive an alert, indicating that a ZFS snapshot was taken and that this shapshot was transferred to your backup storage.

Restore an entire image

  1. In the “Images” tab click on the image you just created above by cloning a master image to open the properties dialog
  2. In the dialog scoll down to the “Backups” drop-down, click it. There should be an entry labeled with the time you clicked “Backup now”. Select this entry, and click “restore”.
  3. Shortly after a new image should be created, labeled with the time of the backup you selected.
    • You can attach this image to a new or an exisisting server, depending on whether or not it contains a bootable operating system
    • You can can browse the files on the image by clicking on the “browse” action – be aware that this only works if the image contains a bootable operating system (because we use guestfish to do the browsing)

Restore select files from an image

  1. In the “Images” tab click on the “browse” icon in group of actions for the image you just restored
    • The “Restore Files” dialog should now be open, which is a hierarchical view of the file system om the image with checkboxes to the left of file and directory entries
    • Browsing and restoring of files requires a valid operating system on the image you are restoring from (with the exeption of ISO’s which can always be browsed)
  2. Check any directory, e.g. “etc” and the click “Restore files”
    • The directory or files you checked will be copied into an iso-image named “Files from: …”, which should show up in the images view, if you have selected “All” from the “Show” drop-down
  3. Click the download icon in the group of actions available for the iso you just created, and save it to your local desktop
    • The iso you downloaded can be mounted by your operating system, and you can view or copy any files as you like

A bit about backup in Stabile

Stabile can back up images managed by Stabile in two ways, using rdiff-backup (a rsync-based utility) or ZFS snapshots. The preferred way of backing images up is using ZFS snapshots. This is because ZFS snapshots are a very efficient way of keeping a record of changes to your images. ZFS snapshots are neatly organized in simple directory structures located at /stabile-images/images/.zfs/snapshot/, /stabile-backup/images/.zfs/snapshot/ for backup of shared storage and /stabile-backup/node-xxx for node storage, where xxxx is the node id. This can come in very handy at times. Stabile will keep these two collections of snapshots in sync by performing a daily synchronization (managed by the Stabile cron jobs). The number of snapshots that are kept (i.e. retention) is governed by the options “Z_BACKUP_RETENTION” and “Z_IMAGE_RETENTION” in the Stabile configuration file (/etc/stabile/config.cfg). These options can be either plain numbers, in which case they specify the number of snapshots to keep, or a number of days like e.g. “Z_BACKUP_RETENTION=14d”, in which case backup snapshots older than 14 days are deleted.

All of the above of course only works, when both your image storage and backup storage are located on dedicated ZFS storage. If for some reason you can not use ZFS, Stabile gives you the option of backing individual images up using rdiff-backup. Backing up an image using rdiff-backup is done by either clicking the “backup” action for the image or specifying a backup schedule for the image in the image properties dialog. Using rdiff-backup backups is only recomended for a small number of images and only if you are using fast (SSD og NVMe) storage. This is because an image has to be read in its entirety every time it is backed up, which is very ressource intensive.

Products

Ressources

Company