Skip to main content

Metadata-Aware Partial Backup Creator

Project description

🗂️ partial-backup: Metadata-Aware Partial Backup Creator

This utility scans a given directory in a structured "unbacked" format and generates a Backup object that can be written back as a valid backup. It preserves directory and file metadata such as ownership (user_), group (group_), and file mode (mode_), and skips common junk files.


📦 Features

  • Recursively scans a directory organized by domain (e.g., HomeDomain)
  • Supports embedded metadata in directory names (user_501_group_0_mode_755)
  • Preserves and serializes:
    • File contents
    • Directory structure
    • Ownership and permissions
  • Skips system-specific noise like .DS_Store and Thumbs.db
  • Outputs a fully reconstructable Backup object
  • Simple CLI using Typer

🛠️ Installation

pip install partial-backup

🧪 Example Usage

Assume your source directory is structured like this:

unback/HomeDomain/
├── user_501_group_0_mode_777/Library
│   └── Preferences/
│       └── com.example.settings.plist

To generate the backup:

partial-backup unback/ output/

It will:

  • Detect HomeDomain
  • Extract user/group/mode from directories like user_501_group_0_mode_777
  • Generate a Backup object
  • Save the reconstructed backup to output/

♻️ Restore the Backup

The generated backup is compatible with pymobiledevice3, and can be restored to an iOS device using:

pymobiledevice3 backup2 restore /path/to/backup --source . --no-copy --system

📁 Metadata Syntax

This tool supports optional metadata hints in folder names:

Syntax Meaning ---
user_501 File owned by user 501
group_20 File belongs to group 20
mode_755 File or directory mode
user_501_group_20_mode_644 All of the above

These metadata markers are automatically removed from paths and applied to the appropriate file or directory entry.

⛔ Ignored Files

The following files and folders are skipped automatically:

  • .DS_Store
  • Thumbs.db
  • desktop.ini
  • .Spotlight-V100
  • .Trashes

API Overview

from pathlib import Path
from partial_backup.backup import Backup

backup = Backup.create_backup_from_directory(Path('/path/to/unback'))
backup.write_to_directory(Path('/path/to/output'))

🙏 Acknowledgments

Huge thanks to @JJTech0130 for his insights and foundational work on the backup DB implementation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

partial_backup-0.0.1.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

partial_backup-0.0.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file partial_backup-0.0.1.tar.gz.

File metadata

  • Download URL: partial_backup-0.0.1.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for partial_backup-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2b7da508a308217a86e5e745c5d4281421f9962ab5aa188763494cca7f3652f7
MD5 345dd57414bfa825b77c9559e4df2454
BLAKE2b-256 9c7342ae72f2f3e32712550e9838a89b72ab1471205c23a9d151817b38f117b6

See more details on using hashes here.

File details

Details for the file partial_backup-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: partial_backup-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for partial_backup-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1a4b141ff3d7d29942bd7343ba2f0c4f074e6a3591296af75e4fc7cc71c7e224
MD5 d3f34b0f70878a5e365f0fa4c5a39648
BLAKE2b-256 7af86c36f98e0f61530bb49d8b8349b654325f26434dd294fcdc03a8d50cf9e4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page