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.2.tar.gz (14.6 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.2-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: partial_backup-0.0.2.tar.gz
  • Upload date:
  • Size: 14.6 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.2.tar.gz
Algorithm Hash digest
SHA256 cf99e20d381ed2dfbb06a1156047890a295f49cc32158b7f3984d20c35270285
MD5 dab5df14fd8c28a887b34a98ea9c4d71
BLAKE2b-256 9d868210a4c3851b3a094437e230f7b34e461a01ce0c30eecf30d63df8e70a7b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: partial_backup-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.6 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f6b7c5e0c478c18c75de022ac653c1fc45aa5691fa5eb98ea37337179ed476fe
MD5 11eca118418176ea28a6c657471a50ce
BLAKE2b-256 1351e2ac1e10b5025cceb2a40800bca4fa34bf5a6b1caae07d0423da4890b6bc

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