borg/docs/usage/copy.rst.inc
Thomas Waldmann cf58f9a05a
copy: new command to copy an archive to a new archive name, #2300
Copying is cheap and fast: no file content is read or written, only a new
archive metadata object is created. Like any deduplicated archives, the two
archives share their data, so a copy needs almost no additional repository
space.

The copy is an independent archive: deleting either of the two archives
keeps the other one intact, because "borg compact" only frees chunks that no
remaining archive references.

Archive.copy() is Archive.rename() without removing the original archive
entry. Copying an archive to its own name is refused: the new metadata would
be identical, thus have the same archive ID, and no second archive would be
created. NEWNAME may well be the name of some other existing archive, the
copy then just joins that archive series.

OLDNAME must match precisely one archive, so it accepts an archive name (if
it is unique) or an archive ID like "aid:d34db33f".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-28 06:30:19 +02:00

72 lines
No EOL
3.1 KiB
HTML

.. IMPORTANT: this file is auto-generated from borg's built-in help, do not edit!
.. _borg_copy:
borg copy
---------
.. code-block:: none
borg [common options] copy [options] OLDNAME NEWNAME
.. only:: html
.. class:: borg-options-table
+-------------------------------------------------------+-------------+-----------------------------------------+
| **positional arguments** |
+-------------------------------------------------------+-------------+-----------------------------------------+
| | ``OLDNAME`` | specify the existing archive name or ID |
+-------------------------------------------------------+-------------+-----------------------------------------+
| | ``NEWNAME`` | specify the new archive name |
+-------------------------------------------------------+-------------+-----------------------------------------+
| .. class:: borg-common-opt-ref |
| |
| :ref:`common_options` |
+-------------------------------------------------------+-------------+-----------------------------------------+
.. raw:: html
<script type='text/javascript'>
$(document).ready(function () {
$('.borg-options-table colgroup').remove();
})
</script>
.. only:: latex
OLDNAME
specify the existing archive name or ID
NEWNAME
specify the new archive name
:ref:`common_options`
|
Description
~~~~~~~~~~~
This command copies an existing archive to a new archive with a different name,
keeping the existing archive.
Afterwards, the repository has two archives with the same contents, but with
different names and different archive IDs. The copy is an independent archive:
deleting either of the two archives keeps the other one intact, because
``borg compact`` only frees chunks that no remaining archive references.
Copying is cheap and fast: no file content is read or written, only a new archive
metadata object is created. Like any deduplicated archives, the two archives share
their data, so a copy needs almost no additional repository space.
Because archive names do not need to be unique, NEWNAME may also be the name of
some *other* already existing archive - the copy then just becomes another archive
of that archive series.
NEWNAME must be different from the name of the archive that is copied, though: the
copy would get identical metadata and thus the same archive ID as its source, so no
second archive could be created.
OLDNAME must match precisely one archive: give an archive name (if it is unique) or
an archive ID, like ``aid:d34db33f``.
Note: to copy archives into a *different* repository, use ``borg transfer``.