「Borg backup」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(→‎Usage: 翻訳)
35行目: 35行目:
 
$ borg help ''command''
 
$ borg help ''command''
   
== Usage ==
+
== 使い方 ==
   
  +
Borg の背後にある主な概念は '''重複排除''' です。従来の TAR アーカイブのようにファイルを蓄積するのではなく、重複排除ではファイルの名前に関係なく、一度だけコピーされるようにファイルをハッシュすることで、ファイルのアイデンティティを検証します。これは、圧縮を行わなくても、増分バックアップを繰り返すために必要なスペースが最小限であることを意味します。
The main concept behind Borg is '''de-duplication''': rather than accumulating files as in traditional TAR archiving, de-duplication verifies the identity of files, regardless of their names, by hashing them so that they are only copied once. This means that even without compression, it takes up minimal space for repeated incremental backups.
 
   
  +
ファイル圧縮はオプションで、複数のアルゴリズム (zstd を推奨) と圧縮率をサポートします。
File compression is optional and supports multiple algorithms (zstd is recommended) and intensities.
 
   
  +
Borg で作成されたアーカイブは、個々のファイルを参照および復元するために FUSE ファイルシステムとしてマウントできます。
Archives created with Borg can be mounted as FUSE filesystems for browsing and restoring individual files.
 
   
  +
アーカイブは、[[SSHFS]]、[[NFS]]、[[Samba]]、または同様のマウントソリューションを使用して、ローカルまたはリモートシステム上に作成できます。[[OpenSSH|SSH]] 経由の転送はサポートされていますが、リモートホストで Borg が利用可能である必要があります。
Archives can be created locally, or on remote systems using [[SSHFS]], [[NFS]], [[Samba]], or similar mounting solutions. Transfer over [[OpenSSH|SSH]] is supported, but the remote host must have Borg available.
 
   
=== Creating repositories ===
+
=== リポジトリの作成 ===
   
Borg repositories can be encrypted or made tamper-evident. For more information on modes and options, consult the [https://borgbackup.readthedocs.io/en/stable/usage/init.html?highlight=repokey official documentation on setting up a repository].
+
Borg リポジトリは、暗号化するか、改ざんを防止することができます。モードとオプションの詳細については、[https://borgbackup.readthedocs.io/en/stable/usage/init.html?highlight=repokey リポジトリのセットアップに関する公式ドキュメント] を参照してください。
   
  +
暗号化または認証なしで Borg リポジトリを作成するには:
To create a Borg repository without encryption or authentication:
 
   
 
$ borg init --encryption=none ''/path/to/repo''
 
$ borg init --encryption=none ''/path/to/repo''
   
=== Creating archives ===
+
=== アーカイブの作成 ===
   
  +
{{ic|borg create}} コマンドを使用して、個々のアーカイブ インスタンスをリポジトリ内に作成できます。各アーカイブには一意の名前を付ける必要があります。Borg には [https://borgbackup.readthedocs.io/en/stable/usage/help.html#borg-placeholders プレースホルダーのリスト] が含まれており、日付、時刻、ユーザー名、ホスト名などの文字列を簡単に追加できます。
Individual archive instances can be created within the repository with the {{ic|borg create}} command. Each archive must be given a unique name. Borg includes [https://borgbackup.readthedocs.io/en/stable/usage/help.html#borg-placeholders a list of placeholders] to make adding strings such at dates, times, usernames, and hostnames easier.
 
   
  +
ソースマシンのホスト名と現在の日付を使用して {{ic|archivable-dir}} ディレクトリのアーカイブを作成するには:
To create an archive of the {{ic|archivable-dir}} directory with the hostname of the source machine and the current date:
 
   
 
$ borg create ''/path/to/repo''::{hostname}-{now:%Y-%m-%d} archivable-dir
 
$ borg create ''/path/to/repo''::{hostname}-{now:%Y-%m-%d} archivable-dir
   
  +
Borg は、広範な包含および除外オプションをサポートしています。{{ic|.py}} ファイルをアーカイブから除外するには:
Borg supports extensive inclusion and exclusion options. To exclude {{ic|.py}} files from the archive:
 
   
 
$ borg create ''...'' --exclude '*.pyc' ''/path/to/repo''::''archive-name''
 
$ borg create ''...'' --exclude '*.pyc' ''/path/to/repo''::''archive-name''
   
More information can be found on the {{ic|borg create}} [https://borgbackup.readthedocs.io/en/stable/usage/create.html documentation page].
+
詳細については、{{ic|borg create}} [https://borgbackup.readthedocs.io/en/stable/usage/create.html ドキュメントページ] を参照してください。
   
  +
=== アーカイブのプルーニング ===
=== Pruning archives ===
 
   
  +
古いアーカイブの削除は自動的には実行されませんが、{{ic|borg prune}} コマンドを使用して手動で実行できます。保持するアーカイブの数を指定する必要があり、アーカイブが作成された時間によって制限できます。
The removal of old archives is not performed automatically, but can be performed manually with the {{ic|borg prune}} command. The number of archives to keep must be specified, and can be limited by the time the archive was created.
 
   
  +
過去7日分のアーカイブ、最新の4つの週次アーカイブ、および最新の3つの月次アーカイブのみを保持するには、次のようにします。
To keep only the last 7 daily archives, the last four weekly archives, and the last three monthly archives:
 
   
 
$ borg prune --keep-daily=7 --keep-weekly=4 --keep-monthly=3 ''/path/to/repo''
 
$ borg prune --keep-daily=7 --keep-weekly=4 --keep-monthly=3 ''/path/to/repo''
   
  +
アーカイブの作成時期に関係なく、最新の10個のアーカイブのみを保持するには:
To keep only the last 10 archives, regardless of when they were created:
 
   
 
$ borg prune --keep-last=10 ''/path/to/repo''
 
$ borg prune --keep-last=10 ''/path/to/repo''
   
  +
含まれるアーカイブの数に関係なく、過去30日間のすべてのアーカイブを保持するには:
To keep all archives from the past 30 days, regardless of how many archives that includes:
 
   
 
$ borg prune --keep-within=30d ''/path/to/repo''
 
$ borg prune --keep-within=30d ''/path/to/repo''
   
  +
{{Note|プルーニングはアーカイブを削除しますが、実際にはリポジトリのスペースを解放しません。スペースを解放するには、リポジトリで {{ic|borg compact}} コマンドを使用します。}}
{{Note|Pruning will delete the archives but will not actually free space in the repository. To free space, use the {{ic|borg compact}} command on the repository.}}
 
  +
{{Warning|プルーニングは、{{ic|--prefix}} または {{ic|--glob-archives}} フラグで制限されていない限り、リポジトリ内の ''すべて'' のアーカイブに対して実行されます。}}
{{Warning|Pruning is performed on '''all''' archives in the repository unless restricted by the {{ic|--prefix}} or {{ic|--glob-archives}} flags.}}
 
   
More information can be found on the {{ic|borg prune}} [https://borgbackup.readthedocs.io/en/stable/usage/prune.html documentation page].
+
詳細については、{{ic|borg prune}} [https://borgbackup.readthedocs.io/en/stable/usage/prune.html ドキュメントページ] を参照してください。
   
=== Restoring from an archive ===
+
=== アーカイブからの復元 ===
   
  +
アーカイブから復元するには:
To restore from an archive:
 
   
 
$ borg extract ''/path/to/repo''::''archive-name'' ''path/to/restore''
 
$ borg extract ''/path/to/repo''::''archive-name'' ''path/to/restore''
   
{{Note|Borg will extract the ''full path'' relative to the current working directory. This means that restoring the path {{ic|/home/archuser/path/to/restore}} from an archive while in the archuser's home directory will result in the full restored path being {{ic|/home/archuser/home/archuser/path/to/restore}}}}.
+
{{Note|Borg は、現在の作業ディレクトリからの相対的な ''フルパス'' を抽出します。つまり、アーカイブからユーザのホームディレクトリにあるパス {{ic|/home/archuser/path/to/restore}} をリストアすると、フルリストアのパスは {{ic|/home/archuser/home/archuser/path/to/restore}} になります。}}
   
  +
または、インタラクティブな復元のためにリポジトリをマウントすることもできます。
Alternatively, a repository can be mounted for interactive restoration:
 
   
 
$ borg mount ''/path/to/repo''::''archive-name''
 
$ borg mount ''/path/to/repo''::''archive-name''

2023年2月7日 (火) 06:31時点における版

関連記事

BorgBackup(略してBorg)は重複排除バックアッププログラムです。 オプションで、圧縮と認証済み暗号化をサポートします。

Borg の主な目標は、データをバックアップするための効率的かつ安全な方法を提供することです。使用されるデータ重複排除技術により、変更のみが保存されるため、Borg は毎日のバックアップに適しています。認証された暗号化技術により、完全に信頼されていないターゲットへのバックアップに適しています。

インストール

borg パッケージを インストール して下さい、 開発版は borg-gitAUR で利用できます。

追加機能については、次のパッケージをインストールします。

python-llfuse
アーカイブのマウント用
openssh
リモートホストへの接続用
borgmatic
ターミナルコマンドの代わりに YAML ファイルを介して Borg を制御する一連のラッパースクリプト
pika-backupAUR
Borg 用の libadwaita/GTK4 ベースの GUI
vortaAUR
Borg 用の Qt ベースの GUI

ドキュメント

公式 ドキュメント には -サンプルクイックスタートガイド ローカルドキュメントは borg(1)apropos borg にあります。

さらに、一般的に次のいずれかのコマンドを使用してガイダンスを見つけることができます。

$ borg help

または特定のコマンドの場合:

$ borg help command

使い方

Borg の背後にある主な概念は 重複排除 です。従来の TAR アーカイブのようにファイルを蓄積するのではなく、重複排除ではファイルの名前に関係なく、一度だけコピーされるようにファイルをハッシュすることで、ファイルのアイデンティティを検証します。これは、圧縮を行わなくても、増分バックアップを繰り返すために必要なスペースが最小限であることを意味します。

ファイル圧縮はオプションで、複数のアルゴリズム (zstd を推奨) と圧縮率をサポートします。

Borg で作成されたアーカイブは、個々のファイルを参照および復元するために FUSE ファイルシステムとしてマウントできます。

アーカイブは、SSHFSNFSSamba、または同様のマウントソリューションを使用して、ローカルまたはリモートシステム上に作成できます。SSH 経由の転送はサポートされていますが、リモートホストで Borg が利用可能である必要があります。

リポジトリの作成

Borg リポジトリは、暗号化するか、改ざんを防止することができます。モードとオプションの詳細については、リポジトリのセットアップに関する公式ドキュメント を参照してください。

暗号化または認証なしで Borg リポジトリを作成するには:

$ borg init --encryption=none /path/to/repo

アーカイブの作成

borg create コマンドを使用して、個々のアーカイブ インスタンスをリポジトリ内に作成できます。各アーカイブには一意の名前を付ける必要があります。Borg には プレースホルダーのリスト が含まれており、日付、時刻、ユーザー名、ホスト名などの文字列を簡単に追加できます。

ソースマシンのホスト名と現在の日付を使用して archivable-dir ディレクトリのアーカイブを作成するには:

$ borg create /path/to/repo::{hostname}-{now:%Y-%m-%d} archivable-dir

Borg は、広範な包含および除外オプションをサポートしています。.py ファイルをアーカイブから除外するには:

$ borg create ... --exclude '*.pyc' /path/to/repo::archive-name

詳細については、borg create ドキュメントページ を参照してください。

アーカイブのプルーニング

古いアーカイブの削除は自動的には実行されませんが、borg prune コマンドを使用して手動で実行できます。保持するアーカイブの数を指定する必要があり、アーカイブが作成された時間によって制限できます。

過去7日分のアーカイブ、最新の4つの週次アーカイブ、および最新の3つの月次アーカイブのみを保持するには、次のようにします。

$ borg prune --keep-daily=7 --keep-weekly=4 --keep-monthly=3 /path/to/repo

アーカイブの作成時期に関係なく、最新の10個のアーカイブのみを保持するには:

$ borg prune --keep-last=10 /path/to/repo

含まれるアーカイブの数に関係なく、過去30日間のすべてのアーカイブを保持するには:

$ borg prune --keep-within=30d /path/to/repo
ノート: プルーニングはアーカイブを削除しますが、実際にはリポジトリのスペースを解放しません。スペースを解放するには、リポジトリで borg compact コマンドを使用します。
警告: プルーニングは、--prefix または --glob-archives フラグで制限されていない限り、リポジトリ内の すべて のアーカイブに対して実行されます。

詳細については、borg prune ドキュメントページ を参照してください。

アーカイブからの復元

アーカイブから復元するには:

$ borg extract /path/to/repo::archive-name path/to/restore
ノート: Borg は、現在の作業ディレクトリからの相対的な フルパス を抽出します。つまり、アーカイブからユーザのホームディレクトリにあるパス /home/archuser/path/to/restore をリストアすると、フルリストアのパスは /home/archuser/home/archuser/path/to/restore になります。

または、インタラクティブな復元のためにリポジトリをマウントすることもできます。

$ borg mount /path/to/repo::archive-name

Tips and tricks

Cache exclusion

Archives' size can be reduced by excluding cache directories. Directories that adhere to the Cache Directory Archiving Standard can be automatically excluded by appending --exclude-caches to the archive creation command:

$ borg create ... --exclude-caches /path/to/repo::archive-name

Listing affected files

Many operations in Borg support the --list flag to list affected files or archives. If paired with --dry-run, the user can verify the effects of a given command.

See also