Skip to main content

🗂️ 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.

Metadata

Release files for partial-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)

Source distribution for partial-backup 0.0.2
File Size Uploaded
partial_backup-0.0.2.tar.gz 14.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for partial-backup 0.0.2
File Interpreter ABI Platform
partial_backup-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 23.3 kB

Release files / partial_backup-0.0.2.tar.gz

Download URL partial_backup-0.0.2.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cf99e20d381ed2dfbb06a1156047890a295f49cc32158b7f3984d20c35270285
BLAKE2b-256 checksum
How to use checksums
9d868210a4c3851b3a094437e230f7b34e461a01ce0c30eecf30d63df8e70a7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / partial_backup-0.0.2-py3-none-any.whl

Download URL partial_backup-0.0.2-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f6b7c5e0c478c18c75de022ac653c1fc45aa5691fa5eb98ea37337179ed476fe
BLAKE2b-256 checksum
How to use checksums
1351e2ac1e10b5025cceb2a40800bca4fa34bf5a6b1caae07d0423da4890b6bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page