ReaR Backup Behavior What Is Backed Up And What Is Not
In this article, we will delve into the intricacies of ReaR (Relax-and-Recover) backup behavior, specifically focusing on what is backed up by default and what is excluded. This is a crucial aspect for anyone using ReaR for disaster recovery, as understanding the scope of the backup ensures that critical data is protected while unnecessary files are excluded, optimizing backup size and recovery time. We will address the common question of whether ReaR automatically excludes mounted file systems, folders, and symbolic links that reside outside the physical system drive, and how ReaR determines which folders to back up. This guide is particularly relevant for users managing file servers with substantial storage capacities, such as those reaching 500TB, where selectively backing up the system configuration without including the massive data stores is essential.
ReaR's Default Backup Behavior: A Deep Dive
ReaR's primary goal is to create a bootable recovery image that allows you to restore your system to a working state in case of a failure. This involves backing up the essential components required for system operation, such as the operating system, bootloader, and critical configuration files. However, to ensure efficiency and avoid backing up unnecessary data, ReaR employs a selective approach, focusing on the core system while excluding data that can be restored from other sources or is not critical for system recovery. Understanding ReaR's default behavior is paramount for tailoring your backup strategy to meet specific requirements and prevent unexpected outcomes during a recovery scenario.
Core System Components Included in ReaR Backups
By default, ReaR includes the following key components in its backups:
- Operating System: The core operating system files, including the kernel, system libraries, and essential utilities, are backed up to ensure that the system can boot and function after recovery.
- Bootloader: The bootloader, such as GRUB or LILO, is crucial for initiating the boot process. ReaR includes the bootloader configuration and related files to ensure that the system can boot from the recovery image.
- Configuration Files: System-wide configuration files located in directories like
/etc
are backed up as they contain critical settings for system services, networking, user accounts, and other essential functions. These files are vital for restoring the system to its previous state. - Installed Applications: ReaR can include installed applications and their associated files, depending on the configuration. This ensures that the applications are available after recovery, minimizing the need for reinstallation.
- Partition Table: The partition table, which defines the structure of the storage devices, is included in the backup. This is essential for recreating the disk layout during recovery.
Files and Directories Excluded by Default
To maintain efficiency and avoid backing up unnecessary data, ReaR excludes certain files and directories by default:
- Mounted File Systems: By default, ReaR does not automatically back up mounted file systems that reside on separate partitions or external storage devices. This is a crucial behavior for file servers with large data stores, as it prevents the backup from including terabytes of data that are not essential for system recovery. This exclusion significantly reduces backup size and time.
- Temporary Files: Directories like
/tmp
and/var/tmp
, which contain temporary files, are excluded from the backup. These files are not critical for system recovery and can be safely excluded. - Cache Directories: Cache directories, such as
/var/cache
, are excluded to reduce backup size. Cached data can be regenerated after recovery. - Log Files: Log files in
/var/log
are typically excluded, as they can grow large and are not essential for system recovery. However, it's possible to include specific log files if needed for troubleshooting purposes. - User Home Directories: By default, user home directories (e.g.,
/home
) are excluded to prevent backing up personal data. However, this behavior can be customized to include specific user directories if required.
ReaR and Symbolic Links: How They are Handled
Symbolic links, also known as symlinks, are essentially pointers to other files or directories. ReaR handles symbolic links in a specific way to ensure that the target files or directories are correctly restored during recovery. When ReaR encounters a symbolic link during the backup process, it typically backs up the link itself, not the content of the linked file or directory. This means that during recovery, ReaR will recreate the symbolic link, pointing to the original target location. However, if the target file or directory is not included in the backup (e.g., because it resides on an excluded mounted file system), the symbolic link will be recreated, but it will point to a non-existent location. Therefore, it's crucial to ensure that the target of any symbolic link that is critical for system operation is either included in the backup or can be restored from another source.
ReaR Configuration Options for Customized Backup Behavior
While ReaR has sensible defaults, it also provides a wide range of configuration options to tailor the backup behavior to specific needs. These options allow you to include or exclude specific files, directories, or file systems, ensuring that your backup contains exactly what you need for recovery.
Modifying the BACKUP_PROG_INCLUDE
Variable
The BACKUP_PROG_INCLUDE
variable in the /etc/rear/local.conf
file is a powerful tool for specifying additional files or directories to be included in the backup. This variable accepts a space-separated list of paths. For example, to include the /opt
directory and the /etc/myconfig.conf
file, you would add the following line to local.conf
:
BACKUP_PROG_INCLUDE=( '/opt' '/etc/myconfig.conf' )
Using the BACKUP_PROG_EXCLUDE
Variable
Conversely, the BACKUP_PROG_EXCLUDE
variable allows you to exclude specific files or directories from the backup. This is useful for excluding large or non-essential files that might otherwise be included by default. For instance, to exclude the /var/cache
directory, you would add the following line to local.conf
:
BACKUP_PROG_EXCLUDE=( '/var/cache' )
Handling Mounted File Systems with EXCLUDE_MOUNTPOINTS
The EXCLUDE_MOUNTPOINTS
variable provides fine-grained control over the exclusion of mounted file systems. By default, ReaR excludes all mounted file systems that are not part of the root file system. However, you can customize this behavior by specifying a list of mount points to exclude or include. To exclude specific mount points, you can list them in the EXCLUDE_MOUNTPOINTS
variable:
EXCLUDE_MOUNTPOINTS=( '/mnt/data' '/mnt/backup' )
To include specific mount points that would otherwise be excluded, you can use the !
prefix. For example, to exclude all mount points except /mnt/important
, you would use the following configuration:
EXCLUDE_MOUNTPOINTS=( '! /mnt/important' )
Utilizing COPY_AS_IS
for Critical Files
The COPY_AS_IS
variable allows you to specify files that should be copied to the recovery image exactly as they are, without any modifications. This is useful for critical configuration files that must be preserved in their original state. For example, to ensure that the /etc/resolv.conf
file is copied as-is, you would add the following line to local.conf
:
COPY_AS_IS=( '/etc/resolv.conf' )
The Role of BACKUP_PROG_OPTIONS
BACKUP_PROG_OPTIONS
allows you to pass additional options to the backup program used by ReaR (e.g., tar
, rsync
). This provides a way to fine-tune the backup process further. For example, if you are using tar
as the backup program, you can use BACKUP_PROG_OPTIONS
to specify compression options or exclude specific file types.
ReaR and Large File Servers: Best Practices for Backup and Recovery
When dealing with large file servers, such as those storing 500TB of data or more, it's crucial to adopt a strategic approach to backup and recovery. Backing up the entire file server, including the data stores, is often impractical due to the sheer volume of data involved. Instead, the focus should be on backing up the system configuration and metadata necessary to restore the server to a functional state, while excluding the data itself. This approach significantly reduces backup size and recovery time. Here are some best practices for using ReaR in large file server environments:
Excluding Data Stores
As discussed earlier, ReaR automatically excludes mounted file systems by default. This is a crucial behavior for large file servers, as it prevents the backup from including the massive data stores. Ensure that your data volumes are mounted on separate partitions or external storage devices and that these mount points are excluded from the backup. You can verify this by checking the EXCLUDE_MOUNTPOINTS
variable in your ReaR configuration.
Backing Up Mount Points and Links
While the data itself is excluded, it's essential to back up the mount points and symbolic links that point to the data stores. This ensures that the file server can remount the data volumes after recovery and that any symbolic links to files within the data stores are recreated. ReaR includes the necessary information to recreate mount points and symbolic links, provided that the target locations are accessible after recovery.
Implementing a Separate Data Backup Strategy
Since ReaR primarily focuses on system recovery, it's crucial to implement a separate data backup strategy for the file server. This might involve using dedicated backup software, storage replication, or other data protection mechanisms. The data backup strategy should be designed to meet the specific requirements of your organization, including recovery time objectives (RTOs) and recovery point objectives (RPOs).
Testing the Recovery Process
Regularly testing the recovery process is essential to ensure that your backup strategy is effective. This involves performing a trial recovery of the file server to verify that the system can be restored to a functional state and that the data volumes can be successfully remounted. Testing the recovery process helps identify potential issues and allows you to fine-tune your backup and recovery procedures.
ReaR and RAID Configurations
When dealing with RAID (Redundant Array of Independent Disks) configurations, ReaR can play a crucial role in restoring the system to a functional state after a failure. ReaR backs up the RAID configuration, allowing you to recreate the RAID array during recovery. This is essential for ensuring data availability and integrity. However, it's important to note that ReaR does not back up the data stored on the RAID array itself. As mentioned earlier, a separate data backup strategy is necessary for protecting the data.
Post-Recovery Steps for Large File Servers
After recovering a large file server using ReaR, there are several post-recovery steps that should be performed to ensure that the system is fully functional:
- Verify Mount Points: Check that all data volumes are mounted correctly and that the mount points are accessible.
- Restore Data (If Necessary): If data loss occurred, restore the data from your separate data backup.
- Verify Symbolic Links: Ensure that all symbolic links are pointing to the correct locations.
- Test Applications and Services: Test all applications and services to ensure that they are functioning properly.
- Monitor System Performance: Monitor system performance to identify any potential issues.
Conclusion
Understanding ReaR's backup behavior is essential for effective disaster recovery planning. By default, ReaR focuses on backing up the core system components while excluding large data stores and other non-essential files. This approach ensures that the recovery image is as small as possible, minimizing backup size and recovery time. However, ReaR also provides a wide range of configuration options to customize the backup behavior to meet specific needs. For large file servers, it's crucial to exclude the data stores from the ReaR backup and implement a separate data backup strategy. By following best practices and regularly testing the recovery process, you can ensure that your file server can be quickly and reliably recovered in the event of a failure. This comprehensive guide has provided you with the knowledge to confidently use ReaR in various scenarios, ensuring your systems are well-protected and recoverable.
By leveraging ReaR's capabilities and tailoring the backup strategy to your specific environment, you can effectively safeguard your systems and minimize downtime in the event of a disaster. Remember to regularly review and update your backup strategy to adapt to changing needs and ensure ongoing protection.