Choosing a storage snapshot tool

Partimage

Partimage [3] lets you convert partitions into images. If necessary, Partimage can restore these images at any time. The software is available in the repositories of almost all popular Linux distributions, and you can support it on any supported Linux system using the appropriate package management tools.

Partimage is also included with SystemRescueCD [14], a live system that is also suitable for 32-bit computers. You can use Partimage from SystemRescueCD without the need to install.

Partimage not only saves and restores images locally, but also across the network. The software supports many popular Linux filesystems, including ext2/3, XFS, UFS, JFS, and ReiserFS. Partimage also supports FAT16/32, HPFS, HFS+, and limited NTFS systems used by other platforms, which makes the software particularly suitable for use in heterogeneous environments. Unfortunately, Partimage lacks support for modern filesystems such as ext4 and Btrfs, so its suitability for Linux partitions is limited.

To use the ncurses program, enter the partimage command at the prompt of a root terminal window. If you use SystemRescueCD, you can activate the program at the command line using the same command or call it on the Xfce desktop via System | Partimage.

Partimage's ncurses screen then appears. The text window groups all the partitions found on the system; you can then choose the one to use for creating an image. Below the window, enter a name for the image in the input line.

The partition to be backed up has to be unmounted, because Partimage cannot back up mounted partitions. If you forget to do this, the software displays an error message and cancels the action.

Once you have an image name, you can then decide whether to save the partition locally in a file or on a network server. If required, you can specify the server IP and determine whether Partimage should transmit the data with SSL encryption (Figure 5).

Figure 5: Partimage works with a classic ncurses interface.

Pressing F5 takes you to the next screen, where you decide whether Partimage should compress the data. Bzip2 and gzip are two more traditional compression formats. However, backing up a larger partition can take a long time, especially on slow computer systems with conventional hard disks. Uncompressed storage is a faster alternative, but it does not save space on the hard disk.

In the next dialog, you have the option to check the partition before saving it. By default, this option is enabled, because it protects data integrity. You can also add an image description at this point, if needed.

If you choose to enter a description, the program displays a new window with an input field. You will want to enable the Prompt before overwriting option; otherwise, the software will flatten existing images with the same name.

Under the Image split mode group, you can specify whether you want to split the image into different files. Either the software stops when the disk is full, or Partimage splits the image into several files of a fixed size, which you define in this dialog group.

The option Wait after each volume change interrupts the cloning process until the user has replaced a full removable disc. Finally, use the If finished successfully group to define an action that Partimage should start as soon as the software has created the image. Pressing F5 displays a safety prompt, and Partimage then generates the image (Figure 6).

Figure 6: Partimage offers many options for creating images.

To restore an image, call the same initial dialog, but select the Restore partition from image option in the first window (Figure 5). You also need to specify the image's filename. Then press F5, which displays an Options window again. Under Options, you can also specify whether to simulate the restoration (nothing is written) and whether to delete free blocks with a zero value.

After setting the options and pressing F5, a status message and a confirmation prompt appear, before Partimage restores the partition. This terminates the program or shuts down the system depending on the settings (Figure 7).

Figure 7: Partimage offers only a few restore options.

qt-fsarchiver

The GUI for the FSArchiver [15] command-line program, qt-fsarchiver [4], groups the many FSArchiver parameters into an intuitive interface. This makes creating images and saving them child's play.

Currently, the software is only available in repositories of the Russian ALT Linux distribution, but there is also a Ubuntu PPA. On the project website, you will also find deb and RPM packages for recent distributions, and there is a live system based on Ubuntu 18.04 LTS [16].

Qt-fsarchiver backs up single partitions, as well as complete disks. Support is available for the ext2/3/4, JFS, XFS, Btrfs, VFAT, and NTFS filesystems. In addition, the software can archive a mass storage medium's MBR or GPT, including current NVMe SSDs. Integrated data compression saves space on the target disk. Among other methods, the software supports bzip2, gzip, qzip, and LZMA.

The program comes with a clear user interface that allows for immediate production use without training. Below a menu and buttonbar, qt-fsarchiver lists all the partitions available on the system on the right hand side, specifying the filesystem and the size in a table.

Below this, the currently mounted system's directory tree appears. You can specify where you want the software to store the image. The actual configuration options for creating and restoring images are available in the window on the left. First select a radio button to specify whether you want to create or restore an image. Below this, you will find some options for compression and encryption, as well as for potentially splitting the image into several files. In addition, you need to enter the image's name in an empty text field (Figure 8).

Figure 8: Qt-fsarchiver comes with a very clear user interface.

Pressing the Save partition button creates the image. Statistical information at the bottom of the dialog window lets you follow the process' progress.

A separate dialog is available for cloning a mass storage device (Figure 9). To reach the dialog, select Actions | Clone Disk, Create, and Restore Image. In a new window, choose your course of action by selecting a radio button in the Planned action area. Options include creating or restoring a hard disk or a partition's image. As a further option, you can elect to clone the hard disk.

Figure 9: Both the cloning and image creation dialogs are intuitive.

Depending on your selection, different target and source media appear in the center part of the window. If you create a partition image, an additional directory tree appears to let you specify the target directory where you want to save the image. When you clone a hard disk, a second, preferably similar data carrier should be used as the target drive on the system.

On the dialog box's right side, choose a button to trigger an action or end a process. In the lower window segment, a progress indicator with absolute numbers and a progress bar indicate the task's progress.

Qt-fsarchiver also stores images on the network. Select Save partitions on the network in the Actions menu. This procedure displays a dialog if you open an SSH connection to a server. In another dialog, you then specify the partition to be backed up and the desired target directory. Then start the backup.

In the same way, you can restore images available on the network by selecting the Restore a partition from the network option in the Actions menu.

Snapper

Snapper [5] creates snapshots at the command line. The software is available for 32- and 64-bit hardware. Precompiled binary packages are available for numerous distributions [17], including Centos, Debian, Fedora, openSUSE, RHEL, Suse Enterprise Linux, Scientific Linux, and Ubuntu. In addition, there are software repositories that let you easily integrate Snapper into the package sources of various distributions.

Debian and Ubuntu users can install a GUI for Snapper [18] using the commands in Listing 1. On openSUSE, Snapper is available with a GUI in YaST 2 by default.

Listing 1

Installing Snapper on Debian and Ubuntu

sudo apt install python3 libgtksourceview-3.0-1 python3 python3-dbus python3-setuptools git python3-dbus python3-setuptools git
git clone --depth=1 https://github.com/ricardomv/snapper-gui.git
sudo python3 setup.py install
snapper-gui

Snapper, which was created by the SUSE developers, orientates its functionality on SUSE's products. Not surprisingly, Snapper offers an optional module for SUSE's configuration interface YaST 2 and supports the Zypper package manager, both of which are used exclusively in SUSE Linux Enterprise and openSUSE.

Additionally, there is a module for the GRUB 2 bootloader that generates several boot menu entries optimized for Snapper. Snapper relies on the Btrfs filesystem, which is the standard operating system in openSUSE.

Snapper cannot be used reliably with other filesystems, which is why I would strongly advise against using it with the popular ext3 or ext4 filesystems.

The tool not only creates and configures snapshots and reconstructs them on demand, but it also compares them against each other and modifies them. Note that the YaST 2 module, which helps to compare and modify snapshots, cannot modify the Snapper configuration. To modify the configuration, you'll need a terminal.

It is important to configure the software before first use so that it generates the appropriate snapshots. Otherwise, Snapper always creates a snapshot of the main directory in the Btrfs filesystem, and ignores all other sub-volumes. Even the user's home partition with the XFS filesystem preinstalled with openSUSE is not included in the snapshot.

Sub-volumes such as the home partition can be manually added to a Snapper snapshot at any time. However, the sub-volume must use Btrfs. In openSUSE, ext3 and ext4 partitions can be converted to Btrfs partitions, but not the default XFS partition.

By default, Snapper stores a configuration file for each sub-volume in the /etc/snapper/configs/ directory. These files can be freely edited. You will want to adjust these settings on desktop systems, since the snapshot software creates an image whenever you use YaST and Zypper by default. In addition, you can define intervals at which Snapper automatically generates snapshots.

If used frequently, the software quickly takes up a large amount of space on your mass storage. Since openSUSE creates a 30GB root partition during the standard installation, you need to grow this partition to at least 200GB when using Snapper to avoid capacity problems.

You can configure the root directory in the root file, which you will find in the /etc/snapper/configs/ directory. In the limits for timeline cleanup section, define how many snapshots you want to keep. The prerequisite for this setting is that the create hourly snapshots section contains a TIMELINE _CREATE="yes" option.

For desktop systems, it is recommended to reset the exaggerated default values to a maximum of two to three snapshots in the TIMELINE_LIMIT_HOURLY and TIMELINE_LIMIT_DAILY options. You will also want to reduce the values for the TIMELINE_LIMIT_MONTHLY and TIMELINE_LIMIT_YEARLY options to a low single-digit number (Figure 10).

Figure 10: The configuration can be changed in the terminal if necessary.

If you want to save further sub-volumes with Snapper, you again need to include them at the command line. To also include the user's home partition set up by openSUSE in Snapper, enter

sudo snapper -c home create-config /home

at the prompt. As mentioned previously, the home directory must be formatted with Btrfs for Snapper. If the home directory uses XFS, you cannot change it retroactively for integration with the snapshot program.

A configuration file lets you adjust the default settings for taking snapshots of the home sub-volume. The sudo snapper list-configs command checks whether Snapper has created the configuration file correctly, while sudo snapper list lists all snapshots saved by Snapper in the default configuration. If you want to avoid restoring certain files from snapshots, you can list them in the /etc/snapper/filters file.

If you prefer not to use the command line for controlling the program, simply call up the GUI interface. To open the GUI, select Snapper from the Miscellaneous group in YaST. The interface window that then appears shows the available snapshots grouped by sub-volume. If you modify the system by installing new software with the help of YaST and Zypper, for example, the list shows before and after entries. In this case, two IDs appear (Figure 11).

Figure 11: Snapper's GUI clearly lists the existing snapshots.

If you want to define a sub-volume area in which there are changes, select the corresponding snapshot pairs with the mouse and click on Show Changes. A tree view on the left side lists the directories and files in question. On the right side of the window, there are also radio buttons for selecting changes, as well as the creation date and time when the two snapshots were created (Figure 12).

Figure 12: Snapper can also compare snapshots.

To manually create a snapshot, select the desired sub-volume from the list at the top of the interface's main window. After clicking on Create, enter the desired data for the snapshot in another window. You need to pay attention to whether you are creating a one-off snapshot or before-and-after snapshots. In the case of before-and-after snapshots, you need to link the new snapshot with an existing one.

If there are problems with the current sub-volumes requiring you to restore a snapshot, first switch to the overview page. The overview page shows the changes made to the selected snapshots. You can click on Restore Selected to restore the previous snapshot. In a separate confirmation window, the list of changed files appears (Figure 13).

Figure 13: Snapper lists the files to be restored separately.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Snapper

    Thanks to Btrfs snapshots, Snapper lets you restore a system to a previous state in case of failure.

  • Snapper

    Snapper lets you restore a system to its previous state – with a little help from Btrfs snapshots.

  • Clonezilla SE

    Managing a network of computers can be an involved process. Clonezilla SE lets you image and roll out multiple machines with ease.

  • Cloning Hard Disks

    Is your hard disk making strange noises? Do you intend to make some major hardware changes? Maybe it’s high time to clone your disk. Four tools help Linux users and system administrators move their data and create one-to-one copies.

  • Clonezilla

    Clonezilla Live backs up and clones complete partitions or hard disks. The popular live system comes with an easy-to-use interface.

comments powered by Disqus