Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 125 additions & 1 deletion docs/quickstart.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,132 @@
.. include:: global.rst.inc
.. highlight:: bash
.. _quickstart:

Quick Start
===========

This chapter will get you started with Borg-Import.

Prerequisites
-------------

Before using borg-import, you need:

1. **BorgBackup installed**: borg-import requires the ``borg`` command to be available in your PATH.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on your PATH?

Install it following the `BorgBackup installation guide <https://borgbackup.readthedocs.io/en/stable/installation.html>`_.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strictly taken, the user has to use the version selector there and select precisely the version they are using.


2. **Python 3.9 or newer**: borg-import is written in Python and requires a modern Python version.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we upgrade the python requirements, it would always need a change here also. Maybe this hint is not needed, I guess pip will also tell if the python requirement is not fulfilled.

Copy link
Author

@farivar-tabatabaei farivar-tabatabaei Jul 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that pip will catch unmet Python version requirements. However, I think it's still helpful to keep line 17 as a quick upfront reminder for users reading the quickstart guide, especially those who might not be familiar with Python tooling. It provides a clearer picture of the prerequisites before they even try installing, which can help reduce friction and confusion and save time early on.

Also, the Python version requirement doesn’t change regularly, so the maintenance burden for this line should be minimal.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't much "burden", but it can easily happen that this place is overlooked when raising the python requirements and then the docs will differ from the code reality until somebody notices.


3. **Sufficient disk space**: Import operations may require temporary space for intermediate processing.

Basic Usage Pattern
-------------------

All borg-import commands follow this general pattern::

borg-import <IMPORTER> [OPTIONS] <SOURCE> <DESTINATION_REPOSITORY>

Where:

- ``<IMPORTER>`` is one of: ``borg``, ``rsnapshot``, ``rsynchl``, or ``rsync_tmbackup``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we add a new importer, this would need fixing.

Does borg-import -h give a list of importers?

- ``<SOURCE>`` is the path to your existing backup directory or repository
- ``<DESTINATION_REPOSITORY>`` is the BorgBackup repository where archives will be imported

**Important**: Always use absolute paths or SSH URLs for repositories to avoid issues during import.

Quick Examples
--------------

**Import from rsnapshot backups**::

# Create a new Borg repository first
borg init --encryption=repokey /path/to/new/borg/repo
Comment on lines +41 to +43
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move this to an own section.

# Import rsnapshot backups
borg-import rsnapshot /path/to/rsnapshot/root /path/to/new/borg/repo

**Import from rsync+hardlinks backups**::

# Create a new Borg repository first
borg init --encryption=repokey /path/to/new/borg/repo
Comment on lines +49 to +51
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

# Import rsync backups
borg-import rsynchl /path/to/rsync/backups /path/to/new/borg/repo

**Import from rsync-time-backup**::

# Requires a prefix for archive naming
borg-import rsync_tmbackup --prefix=mybackup- /path/to/rsync/backups /path/to/new/borg/repo

**Import from another Borg repository**::

# Useful for rebuilding or migrating Borg repositories
borg-import borg /path/to/old/borg/repo /path/to/new/borg/repo

Common Options
--------------

**Add prefix to archive names**::

borg-import rsnapshot --prefix=imported- /source /destination

**Pass additional options to borg create**::

borg-import rsynchl -o="--compression lz4" /source /destination

**Debug mode for troubleshooting**::

borg-import --debug rsnapshot /source /destination

How It Works
------------

borg-import uses a smart approach to preserve Borg's file cache efficiency:

1. **Temporary relocation**: Source directories are temporarily moved to a common name (``borg-import-dir``)
2. **Archive creation**: Borg creates archives from this temporary location
3. **Restoration**: Original directories are moved back to their original locations
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe avoid the word "restoration" here, considering it is usually used in a different meaning when talking about backing up and restoring files...

4. **Timestamp preservation**: Original backup timestamps are preserved in Borg archives

This process ensures that Borg's deduplication and file cache work optimally across imports.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"files cache"

(the cache file historically was named just "files")


Safety Features
---------------

- **Non-destructive**: Original backup structures are preserved
- **Resume capability**: If interrupted, the process can be safely restarted
- **Duplicate detection**: Archives already present in the destination are automatically skipped
- **Journal tracking**: A ``.snapshot`` file tracks the current operation for recovery

Getting Help
------------

For detailed help on any importer::

borg-import <IMPORTER> -h

For example::

borg-import rsnapshot -h
borg-import borg -h

Common Issues
-------------

**"borg command not found"**
Install BorgBackup first. See the `installation guide <https://borgbackup.readthedocs.io/en/stable/installation.html>`_.

**"borg-import-dir exists. Cannot continue"**
A previous import was interrupted. Check the directory and ``.snapshot`` file to understand what happened, then manually clean up if safe to do so.
Comment on lines +118 to +119
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you see that while using borg-import?


**Permission errors**
Ensure you have read access to source backups and write access to the destination repository.

**Out of space**
Some importers (especially ``borg``) require substantial temporary space. Ensure adequate free space in the working directory.

Next Steps
----------

- Read the detailed documentation for your specific backup format
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean? Read the borg docs?

The converter always converts to a borg repository.

- Consider setting up automated backups with your new Borg repository
- Learn about Borg's powerful features like mounting, pruning, and compression options
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strictly taken, one would think about the desired compression before borg-import-ing into a borg repo and give the respective compression option to borg-import already. Preferably one does not want to use different compression algorithms for borg-import and later for borg.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ where = ["src"]
[tool.setuptools_scm]
write_to = "src/borg_import/_version.py"

[tool.pytest]
[tool.pytest.ini_options]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this from this PR, it is unrelated.

python_files = "testsuite/*.py"
testpaths = ["src"]

Expand Down