** 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.
Metadata
Release files for pisd-backup 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pisd_backup-0.0.2.tar.gz | 6.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pisd_backup-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.2 kB
Release files / pisd_backup-0.0.2.tar.gz
| Download URL | pisd_backup-0.0.2.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ecde73d4f33738b39f1273f606b1843f12a5a0e8077f75ee15d8312683fcd9a3
|
|
BLAKE2b-256 checksum How to use checksums |
bd7eafafc06e79b75169fa82c4cc32d6b8fd86c41b9dc4a278c850a16b61cbc8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.0
|
Release files / pisd_backup-0.0.2-py3-none-any.whl
| Download URL | pisd_backup-0.0.2-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
18dba9ecbadd6c4fab5031f4bbbe7b3fc49bb23b58126dd8401680650f1c815f
|
|
BLAKE2b-256 checksum How to use checksums |
26957775fb2dfc0e964b057399a4a2004300cd569c54b07cbc081d570cfa30fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.0
|
Security for pisd-backup 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.