Python app for creating Raspberry Pi SD card images
Project description
** piSD-backup - Automated Raspberry Pi SD Card Backup**
Overview
piSD-backup is a Python script designed to simplify and automate the backup process for your Raspberry Pi's SD card. It provides a user-friendly interface for installing dependencies, performing backups, scheduling backups with cron jobs, and managing the number of backup files stored. This ensures that your Raspberry Pi's data is safely backed up, allowing for easy recovery in case of SD card failure or corruption.
Key Features
- Automated Backups: Easily create complete image backups of your Raspberry Pi's SD card.
- Scheduled Backups: Set up cron jobs to automate backups at regular intervals.
- Dependency Management: Automatically install required Python dependencies.
- Backup Management: Control the number of backup files stored, preventing excessive disk usage.
- NAS Integration: Seamlessly mount network-attached storage (NAS) volumes for storing backups.
- Command-Line and Interactive Interface: Use the script via the interactive menu or directly from the command line.
Prerequisites
- A Raspberry Pi running a compatible operating system (Raspbian, Raspberry Pi OS, DietPi, etc.).
- A storage location for backups (local drive or NAS).
- Basic familiarity with the Linux command line.
Setup
1. Install Dependencies
- To install the necessary Python dependencies, run the following command:
sudo python3 src/app.py install_dependencies
- Alternatively, use the interactive menu:
sudo python3 src/app.py
- Then select option
1to install dependencies.
2. Mount Volume from NAS (Optional)
- If you intend to store backups on a NAS, follow these steps:
- Create Credentials File:
- Create a file named
/root/.smbServerwith your NAS credentials:
- Create a file named
- Create Credentials File:
username=backups
password=YourSecurePassword
- Important: Replace
YourSecurePasswordwith your actual NAS password. Secure file permissions should be enforced.- Create Backup Directory:
- Create a directory on your Raspberry Pi to mount the NAS share:
- Create Backup Directory:
mkdir backup-raspis
* **Edit `/etc/fstab`:**
* Add the following line to `/etc/fstab` to automatically mount the NAS share on boot:
//Your.NAS.IP.Address/backup-raspis /home/$USER/backup-raspis cifs credentials=/root/.smbServer,uid=1001 0 0
- Important: Replace
Your.NAS.IP.Addresswith the actual IP address of your NAS.- Mount the Share:
- execute
sudo mount -ato mount the newly added fstab entry.
- execute
- DietPi Users:
- For DietPi users, use
sudo dietpi-config, select option14(Autostart Options), and addsudo mount -ato ensure the NAS volume is mounted on startup. - It is also recommended that after mounting the NAS, to run
sudo dietpi-drive_managerand use the resize option.
- For DietPi users, use
- Mount the Share:
Usage
1. Interactive Menu
- To use the interactive menu, run:
sudo python3 src/app.py
- The menu provides the following options:
1. Install Dependencies2. Backup Raspberry Pi3. Setup Cronjob for Option 24. Manage Number of Backups
2. Command-Line Options
- You can also use command-line options for specific actions:
- Install dependencies:
sudo python3 src/app.py install_dependencies
* Backup Raspberry Pi:
sudo python3 src/app.py backup_raspberry_pi
* Setup cron job:
sudo python3 src/app.py setup_cronjob
* Manage number of backups:
sudo python3 src/app.py manage_backups [num_backups]
- Replace
[num_backups]with the desired number of backups to keep.
Cron Job Management
- View Cron Jobs:
- To view existing cron jobs, run:
crontab -l
- Edit Cron Jobs:
- To edit cron jobs, run:
crontab -e
Important Considerations
- Ensure you have sufficient storage space for backups.
- Regularly test your backups to verify they are working correctly.
- When using a NAS, confirm that the NAS is powered on and accessible before scheduled backups.
- Secure your NAS credentials.
- It is best practice to unmount the NAS after the backup has completed.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pisd_backup-0.0.2.tar.gz.
File metadata
- Download URL: pisd_backup-0.0.2.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecde73d4f33738b39f1273f606b1843f12a5a0e8077f75ee15d8312683fcd9a3
|
|
| MD5 |
982974589633587ee8b2cafd2c13b515
|
|
| BLAKE2b-256 |
bd7eafafc06e79b75169fa82c4cc32d6b8fd86c41b9dc4a278c850a16b61cbc8
|
File details
Details for the file pisd_backup-0.0.2-py3-none-any.whl.
File metadata
- Download URL: pisd_backup-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18dba9ecbadd6c4fab5031f4bbbe7b3fc49bb23b58126dd8401680650f1c815f
|
|
| MD5 |
654e9a0629a1b0e7084510d719c23a3f
|
|
| BLAKE2b-256 |
26957775fb2dfc0e964b057399a4a2004300cd569c54b07cbc081d570cfa30fa
|