(Sorry for the inconvenience)
The built-in Life Preserver utility was redesigned for 9.2 to take full advantage of ZFS snapshot functionality. This utility now allows you to schedule snapshots of a ZFS pool and to securely replicate those snapshots to another system using rsync and SSH. This design provides several benefits:
- a snapshot provides a "point-in-time" image of the ZFS pool. In one way, this is similar to a full system backup as the snapshot contains the information for the entire filesystem. However, it has several advantages over a full backup. Snapshots occur instantaneously, meaning that the filesystem does not need to be unmounted and you can continue to use applications on your system as the snapshot is created. Since snapshots contain the meta-data ZFS uses to access files, the snapshots themselves are small and subsequent snapshots only contain the changes that occurred since the last snapshot was taken. This space efficiency means that you can take snapshots often. Snapshots also provide a convenient way to access previous versions of files as you can simply browse to the point-in-time for the version of the file that you need. Life Preserver makes it easy to configure when snapshots are taken and provides a built-in graphical browser for finding and restoring the files within a snapshot.
- replication is an efficient way to keep the files on two systems in sync. In the case of Life Preserver, the snapshots taken on the PC-BSD system will be synchronized with their versions stored on the backup server.
- SSH means that the snapshots will be sent to the backup server oven an encrypted connection, which protects the contents of the snapshots.
When choosing which system to use as the backup server, keep the following points in mind:
- the backup server must be formatted with the latest version of ZFS, also known as ZFS feature flags or ZFSv5000. Operating systems that support this version of ZFS include PC-BSD 9.2, FreeBSD 9.2, and FreeNAS 9.1.x.
- that system must have rsync and SSH installed and the SSH service must be running. If the backup server is running PC-BSD, rsync and SSH are already installed and you can start SSH using Service Manager. If that system is running FreeNAS, rsync and SSH are already installed. How to configure these services is described in Backing Up to a FreeNAS System. If the system is running FreeBSD, SSH is already installed. You will need to install rsync and start SSH.
- if the backup server is running PC-BSD, you will need to open TCP ports 22 (SSH) and 873 (rsync) using Firewall Manager. If the server is running FreeBSD and a firewall has been configured, add rules to open these ports in the firewall ruleset. FreeNAS does not run a firewall by default.
Managing Snapshots Using the GUI
An icon to the Life Preserver utility, seen in Figure 8.19a, can be found in the system tray.
To remove the icon from the system tray, right-click it. To re-add it to the tray, go to Control Panel ➜ Life Preserver or type pc-su life-preserver & at the command line. If your desktop manager does not provide a system tray, you will need to instead manage backups from the command line.
To open the screen shown in Figure 8.19b, double-click the Life Preserver icon. Click the "+" button and select the name of the ZFS pool to backup. Unless you configured a custom pool name during installation, it will be tank. This will launch the the "New Life Preserver Wizard", allowing you to configure the backup schedule. Click "Next" to see the screen in Figure 8.19c.
This screen is used to schedule how often a snapshot is taken of the system. The default is to perform one snapshot per day at 1:00 AM. You can either change the time that this one daily snapshot occurs or select to take a snapshot once every hour, 30 minutes, 10 minutes or 5 minutes.
After making your selection, press "Next" to see the screen shown in Figure 8.19d.
This screen schedules how long to keep the created snapshots. By default, the last 7 days of snapshots are stored on the backup server. In other words, once a snapshot becomes older than 7 days, it is deleted on the backup server. You can select to either keep snapshots for so many days or to keep a certain quantity of snapshots.
After making your selection, press "Next" to see the screen shown in Figure 8.19e.
This screen is used to indicate which system to send the backups to. Click the "Replicate my data" box, then input the following information:
- Host Name: of the remote system that will store your backup. If the backup server is on your local network, the host name must be in your hosts file or in the database of the local DNS server. You may find it easier to instead input the IP address of the backup server as this will eliminate any host name resolution problems.
- User Name: this user must have permission to log in to the system that will hold the backup. If the account does not already exist, you should create it first on the backup server.
- SSH Port: port 22, the default port used by SSH is selected for you. You only need to change this if the remote system is using a non-standard port to listen for SSH connections. In that case, use the up/down arrows or type in the port number.
- Remote Dataset: input the name of an existing dataset on the backup server. This is where the backups will be stored. To get a list of existing datasets, type zfs list on the remote server. The "NAME" column in the output of that command gives the fullname of each dataset. Select one and type its fullname into this field. When selecting a dataset, make sure that the selected "User Name" has permission to write to the dataset.
Once you have input the information, click "Next" and then "Finish". Life Preserver will check that it can connect to the backup server. A pop-up message will remind you to save the SSH key to a USB stick (as described below) as this key is required should you even need to restore the operating system. It will then add an entry for the backup.
You should also create a test snapshot (also described below) to ensure that Life Preserver can successfully replicate to the backup server. The first time you create a test snapshot, you should receive a "OpenSSH Authentication Passphrase Request" pop-up message. Click OK to start replication of the test snapshot.
Click the entry for a backup to activate its configuration buttons, as shown in Figure 8.19f.
These buttons, from left to right, allow you to:
- Enable backups of a new dataset: this button will be greyed out if you only have one pool and have already scheduled a backup of the pool. Otherwise, it will start the "New Life Preserver Wizard" as described above.
- Remove selected dataset from automatic backup: clicking this button will cancel the creation of snapshots and sending them to the backup server. This will remove the entry, meaning that you will have to go through the wizard again to re-enable backups of this pool.
- Customize the backup configuration: this will open the screen shown in Figure 8.19g so that you can modify when the backups occur and how long they are stored on the backup server. If you click the "Replication" tab, you will see the screen shown in Figure 8.19h. This allows you to edit the connection information to the backup server. It also adds a "Frequency" option. By default, the backup occurs right after the snapshot is created. You can modify this so that the backup itself occurs at a set time, regardless of when the snapshots are created. For example, if you have configured snapshots to occur every 30 minutes but the replication frequency to occur daily at 2:00 AM, the 24 snapshots will remain on the PC-BSD system until 2:00 AM when they are copied over to the backup server.
- Manage SSH keys: after creating a backup, you should immediately generate an SSH key and copy it to a USB stick. To do so, click this button then click "Generate SSH Key". A pop-up message will indicate that the key was successfully generated. Then, insert a FAT32 formatted USB stick, click this button again and select "Copy To USB Stick".
- Make a new snapshot: click this button to create a backup now, instead of waiting for the schedule. You will be prompted to input a name for the snapshot. Once you do, the "Latest Snapshot" field will show the name of the snapshot (with the date and time added). The snapshot itself happens instantaneously, however the replication of the snapshot to the backup server will take some time, depending upon the speed of the network and the size of the snapshot. The Life Preserver icon will change to indicate whenever a replication is in progress.
- Browse a snapshot: click this button to browse to the data stored in a snapshot. In the example shown in Figure 8.19i, two test snapshots have been taken: the first was taken on September 10 at 11:02 and the second was taken on September 10 at 11:09. The datasets contained within the ZFS pool are listed and if you hover over a dataset name, such as /usr/home/dru, the available snapshots are listed. If you click a snapshot name, the contents of that dataset at that point in time will be displayed in the window manager's default file manager application. For example, if a file named /usr/home/dru/important.odt was modified at 11:05 and the user wished to access the previous version of that file, they could browse to it in the test-2013-09-10-11-02-23 snapshot as that snapshot was taken before the file was modified.
Last Backup: will indicate whether or not there is a last backup and if there is a successful backup, the time and date of that backup. If you chose to automate backups, the first backup will happen immediately. Otherwise, a backup will not occur until you press the "Start" button. How long the first backup takes depends upon the size of your home directory and the speed of your network. If the backup is unsuccessful, logs can be found in /usr/local/share/lifePreserver/preservers/<preserver_name>/logs/. explains the meaning of the various characters found in the logs.
Status: Running… indicates that the backup is occurring now, otherwise it will show as Not running.
The backup will be stored on the remote system in the home directory of the user that was used by Life Preserver to login. The contents of the backup will be found in the life-preserver/<backup>/ subdirectory where <backup> is named according to the date and time stamp of the backup. The contents of the directory will mirror the directory structure of your home directory, making it very easy to find and restore individual files or directories from the backup server to your PC-BSD® system.
Number of backups to keep: make sure that there is enough disk space on the backup server to store this amount of backups. If you do daily backups, a setting of 7 will keep a week's worth. If you do weekly backups, a setting of 4 or 5 will keep about a month's worth.
Remove incomplete or failed backups: by default, Life Preserver attempts to conserve disk space on the backup server by removing any failed backups. Uncheck this box if you are troubleshooting Life Preserver.
Disable automatic backups: if this is selected, a backup will only occur when you manually press the "Start" button.
Backup daily: if this is selected, a backup will occur once per day.
Backup weekly: if this is selected, a backup will occur once per week.
Remote directory: a subdirectory with the name you specify will be created in the home directory of the user that logs in to the SSH server. This is the location where backups will be stored. The default subdirectory name is life-preserver.
Modify include list: provides a graphical List Editor, seen in Figure 8.19i, for adding files/directories to include in the backup.
Modify exclude list: opens the List Editor in order to add the files/directories to exclude from backups.
When using List Editor, it will indicate whether or not you are editing the include or the exclude list. Use the browse button to select the files or directories that you wish to include or exclude. Alternately, you can type in a wildcard. For example, to select all files ending in the .txt extension, input *.txt.
Restoring a Backup
To restore files from a backup, right-click the preserver entry and select "Restore From". Life Preserver will query the backup server and show a list of available backups as seen in the example in Figure 8.19j:
When reading the backup name, the number before the "T" is the date in YYYY-MM-DD format and the number after the T is the date stamp in HH_MM_SS format. Highlight the backup you wish to restore and click the "Select Backup" button to open the window seen in Figure 8.19k:
If you wish to restore an individual file or directory, input its full path. In the example shown in Figure 8.19k, the user is restoring the directory /usr/home/dru/Documents--in other words, the Documents subfolder backed up from the home directory of the user named dru.
If you just input the name of the file or directory and click the "Restore" button, it will be restored to its original location and replace any files with the same name at that location.
If you instead check the "Restore Relative to specified directory" box, the selected file/directory will be restored to the location you specify.
Managing Snapshots From the Command Line
Backing Up to a FreeNAS System
Restoring the Operating System From a Life Preserver Backup