XEMI Auto Backup is a robust, interactive backup and restoration tool designed for Raspberry Pi systems. Leveraging the power of fsarchiver and lftp, it facilitates versioned backups, secure FTP uploads, and seamless restorations, all through an intuitive terminal-based menu.
XEMI Auto Backup automates the process of backing up and restoring Raspberry Pi systems. It creates compressed, versioned backups using fsarchiver, uploads them to a specified FTP server via lftp, and provides options to restore these backups when needed. The tool ensures data integrity through checksums and maintains detailed logs for each operation.
- Interactive Menu: User-friendly terminal interface for all operations.
- Versioned Backups: Automatically names backups with date and incremental versioning.
- FTP Integration: Securely uploads backups and logs to a remote FTP server.
- Configurable Settings: Easily editable configuration file for FTP credentials and paths.
- Comprehensive Logging: Generates detailed logs for each backup and restoration process.
- Automatic Cleanup: Removes temporary files post-operation to conserve space.
- Selective Restoration: Allows users to choose specific backups to restore.
- Exclusion Paths: Prevents backup of specified directories to avoid redundancy.
-
Hardware: Raspberry Pi with sudo access.
-
Software:
fsarchiver: For creating and restoring backups.lftp: For FTP operations.
-
Remote Server: FTP server with write access for storing backups.
Installation of Dependencies:
sudo apt update
sudo apt install fsarchiver lftp-
Download the Script:
Save the
auto_backup.shscript to your local machine. -
Move and Rename the Script:
mv auto_backup.sh ~/.local/bin/xemi_auto_backup -
Make the Script Executable:
chmod +x ~/.local/bin/xemi_auto_backup -
Ensure the Script Directory is in PATH:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc source ~/.bashrc
-
Run the Script:
xemi_auto_backup
Upon the first run, the script initializes a configuration file at ~/.config/xemi_auto_backup/config.conf. This file contains FTP credentials and paths.
Default Configuration:
# FTP Configuration
FTP_HOST=192.168.1.92
FTP_USER=clouduser
FTP_PASS=cloud842867
FTP_REMOTE_PATH=/volume(sda2)/Recovery/my-backups/raspberrypiEditing Configuration:
To modify the configuration, select option 6 from the main menu or manually edit the file:
nano ~/.config/xemi_auto_backup/config.conf-
Process:
- Prompts for a commit message and description.
- Creates a backup of the specified partition using
fsarchiver. - Generates a
.fsabackup file and a corresponding.logfile. - Uploads both files to the configured FTP server.
- Cleans up local temporary files upon successful upload.
-
Backup Naming Convention:
rpi_backup_YYYY-MM-DD_Version.fsaExample:
rpi_backup_2025-05-04_001.fsa
-
Process:
- Lists available backups on the FTP server.
- Displays associated commit messages and descriptions.
- Allows selection of a specific backup to restore.
- Downloads the selected
.fsafile. - Prompts for the target device to restore the backup.
- Restores the backup using
fsarchiver.
-
Note: Ensure the target device is correctly identified to prevent data loss.
-
Process:
- Retrieves and displays log files from the FTP server.
- Shows details such as commit messages, descriptions, and operating system information.
-
Process:
- Lists available backups on the FTP server.
- Prompts for selection of a backup to delete.
- Confirms deletion to prevent accidental data loss.
- Deletes both the
.fsaand corresponding.logfiles from the FTP server.
-
Process:
- Displays the current FTP configuration settings.
-
Process:
- Opens the configuration file in
nanofor editing.
- Opens the configuration file in
- Script:
~/.local/bin/xemi_auto_backup - Configuration:
~/.config/xemi_auto_backup/config.conf - Logs:
~/.local/share/xemi_auto_backup/logs/ - Temporary Files:
/tmp/(e.g.,.fsa,.log,.backup_marker)
-
Prepare the New SD Card:
- Flash a fresh Raspberry Pi OS onto the SD card.
-
Set Up the Script:
-
Recreate the script directory:
mkdir -p ~/.local/bin -
Move and make the script executable:
mv auto_backup.sh ~/.local/bin/xemi_auto_backup chmod +x ~/.local/bin/xemi_auto_backup
-
-
Run the Script:
-
Execute the script:
xemi_auto_backup
-
Choose option 2 to restore from the cloud.
-
To run xemi_auto_backup from any location:
-
Ensure the Script is in the PATH:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc source ~/.bashrc
-
Run the Script:
xemi_auto_backup
Developed by Víctor G.C.
This tool is intended for personal and educational use. Feel free to modify and enhance it to suit your needs.