Home
Packages
Forums
Wiki
GitLab
Security
AUR
Download
コンテンツにスキップ
メインメニュー
メインメニュー
サイドバーに移動
非表示
案内
メインページ
目次
コミュニティに貢献
最近の出来事
おまかせ表示
特別ページ
交流
ヘルプ
貢献
最近の更新
最近の議論
新しいページ
統計
リクエスト
ArchWiki
検索
検索
表示
アカウント作成
ログイン
個人用ツール
アカウント作成
ログイン
Resticのソースを表示
ページ
議論
日本語
閲覧
ソースを閲覧
履歴を表示
ツール
ツール
サイドバーに移動
非表示
操作
閲覧
ソースを閲覧
履歴を表示
全般
リンク元
関連ページの更新状況
ページ情報
表示
サイドバーに移動
非表示
←
Restic
あなたには「このページの編集」を行う権限がありません。理由は以下の通りです:
この操作は、次のグループに属する利用者のみが実行できます:
登録利用者
。
このページのソースの閲覧やコピーができます。
[[Category:バックアップ]] {{Related articles start}} {{Related|システムバックアップ}} {{Related|ディスクのクローン}} {{Related|システムメンテナンス#バックアップ}} {{Related|ファイルリカバリ}} {{Related articles end}} このページでは、Arch Linux の文脈でのクイックスタートガイドを提供し、最良の方法を提案するための restic [https://restic.readthedocs.io/en/latest/] バックアップツールについて説明します。 主な機能と利点は以下の通りです。 * 暗号化されたバックアップ * リモートバックアップ * 圧縮のための組み込みサポート * 効率的なストレージ (チャンクベースのインクリメント、データは複製されません) * cron や systemd などのカスタムスケジューリングソリューションを使用する柔軟性 * go で書かれているおり、スタンドアロンのバイナリ == インストール == {{Pkg|restic}} を[[インストール]]し、その後、空のディレクトリでリポジトリを初期化します (ローカルバックアップ用) : $ restic init --repo ''/path/to/backup/directory/'' 公式チュートリアル [https://restic.readthedocs.io/en/latest/010_introduction.html] を参照してください。 == セキュリティ == Restic はリポジトリの対称暗号化を使用します。これは、自動化されたプロセスがバックアップを作成できるように、一般的にキーをプレーンテキストで保存する必要があるため、バックアップにいくつかの問題をもたらします [https://github.com/restic/restic/issues/533] [https://github.com/restic/restic/issues/2666] 。 Restic は、key vault などからパスワードを取得するスクリプトのアイデアをサポートしています。ただし、key vault やシークレットストアのロックを解除するためにも、おそらくどこかで資格情報をハードコードする必要があるでしょう。理想的には、公開鍵を使用してスナップショットを作成し (restic によって自動化されたスクリプトで使用される) 、プライベートキーでのみスナップショットを復号化できる非対称暗号化があると良いですが、これはサポートされていません。 この問題を回避するために、リポジトリのパスワードを [[LUKS]] 暗号化ボリューム上のファイルに保存できます。ボリュームは、ユーザーが提供する [[YubiKey]] などのパスフレーズや FIDO キー ( [[Universal 2nd Factor]] 参照) を使用して、起動時に復号化されます。crypttab ( [[dm-crypt]] 参照) および [[fstab]] で設定できます。 {{Note|Restic リポジトリ (バックアップ) は、LUKS で暗号化する必要はありません。Restic はデフォルトでデータを暗号化します。}} == スケジューリング == === Systemd タイマー === timeshift [https://github.com/teejee2008/timeshift] などの他のツールとは異なり、restic にはスケジューリング機能が含まれていません。[[cron]] または [[systemd タイマー]] を使用することが期待されています。 [https://github.com/erikw/restic-automatic-backup-scheduler restic-automatic-backup-scheduler] などの準備されたプロジェクトを使用するか、この例に従って、ローカル (完全) システムバックアップを作成し、[[root ユーザー]] として実行する必要があります。 この例では、既存の restic リポジトリが初期化された既存のディレクトリがあると想定されています ( [[#インストール]]参照)。 ==== 別のボリュームを作成する ==== この手順はオプションですが、自動バックアッププロセスが OS に利用可能なスペースをすべて消費する可能性があるため、そこに別のボリュームをマウントすることが良いです。 最初の restic バックアップは、OS 全体をクローンする必要があるため、必要な最小のスペースは、OS によって占められるスペース (以下で説明するパスの除外に対して) 、またはバックアップを決定した他のディレクトリに等しいです。 もちろん、将来の追加のインクリメンタルな変更に対してスペースが必要ですので、バックアップされるデータのサイズの 2 倍、または 3 倍のボリュームを作成することが良いです。例えば、 {{ic|/}} が {{ic|55G}} を占めている場合、 {{ic|/mnt/restic}} を {{ic|110G}} で作成できます。 ==== Systemd サービス ==== サービスユニットが必要なので、[[作成]]します。 {{hc|/etc/systemd/system/restic-backup.service|2= [Unit] Description=Backup system [Service] ExecStart=/usr/local/bin/restic-backup }} {{Note|サービスは以下のタイマーによって呼び出されますが、予定外のスナップショットについては、オンデマンドで [[開始]]することもできます。}} ===== リソース制約の設定 ===== systemd を使用すると、バックアッププロセスにリソース制約を設定するオプションがあります。例えば、メモリと / または CPU の量を制限できます。これは systemd サービスユニットで設定するものです。{{man|5|systemd.resource-control}} を参照してください。 restic が使用するリソースを制約する別の方法は、[https://restic.readthedocs.io/en/latest/047_tuning_backup_parameters.html#cpu-usage 公式ドキュメント] で説明されているように、 {{ic|GOMAXPROCS}} 環境変数を使用することです。 ==== Systemd timer ==== You will also need a timer unit (this one runs every 15 min): {{hc|/etc/systemd/system/restic-backup.timer|2= [Unit] Description=Timer for full system backups [Timer] OnBootSec=5min OnUnitActiveSec=15min Unit=restic-backup.service [Install] WantedBy=timers.target }} ==== Backup script ==== You will also want to create a small shell script to pass in all the required options, for example: {{hc|/usr/local/bin/restic-backup|<nowiki> #!/bin/bash if [[ -n $(pgrep 'restic' | grep 'restic backup') ]]; then echo 'restic is already running...' 1>&2 exit 0 fi set -e set -v export RESTIC_REPOSITORY='/mnt/restic' export RESTIC_PASSWORD_COMMAND='/usr/local/bin/get-restic-password' export RESTIC_COMPRESSION='off' export RESTIC_CACHE_DIR=~/.cache/restic mkdir -p "${RESTIC_CACHE_DIR}" restic unlock restic backup / --exclude-file=/etc/restic/excludes.txt --tag scheduled restic check --with-cache --read-data-subset=5G restic forget --prune --keep-hourly 24 --keep-daily 30 --keep-monthly 6 --keep-weekly 4 --keep-yearly 3 </nowiki>}} {{hc|/usr/local/bin/get-restic-password| #!/bin/bash echo VerySecurePassword123 }} # chmod 744 /usr/local/bin/restic-backup # chmod 700 /usr/local/bin/get-restic-password ===== Compression ===== If you are using the [[Btrfs]] filesystem with compression (e.g. {{ic|compress{{=}}zstd}}) it will not make sense to encrypt the data again as there is limited gain in re-compressing compressed data (it will just make the backups slower). On the other hand if you are using [[ext4]], you might want to [https://restic.readthedocs.io/en/latest/047_tuning_backup_parameters.html#compression enable compression in restic] to save space. ===== Snapshot retention ===== Adjust the {{ic|restic forget --prune --keep-hourly 24 --keep-daily 30 --keep-monthly 6 --keep-weekly 4 --keep-yearly 3}} values in the script above if wanted. ===== Configuring niceness ===== You may also wish to tweak niceness of the backup process. If you are running backups often you will likely want to reduce the resource usage to prevent it from affecting interactive use. However, you should check how long the backups are taking and make sure they are not overlapping (i.e. a new backup being started when the previous one has not finished). You can do that with {{man|1|nice}}. You may want to adjust the backup scrip by adding nice to the beginning of the resource intensive commands e.g.: # nice -n 19 restic backup ... # nice -n 19 restic check ... Alternatively if you are using {{AUR|ananicy-cpp}} you may want to ensure that the niceness is configured in its configuration file(s) under {{ic|/etc/ananicy.d/}}. {{hc|/etc/ananicy.d/00-types.types| {"type":"file-sync","nice":19,"ionice":7} }} {{hc|/etc/ananicy.d/99-custom/file-sync/restic.rules| {"name": "restic", "type": "file-sync"} }} Refer to the [https://restic.readthedocs.io/en/latest/faq.html?highlight=nice#how-to-prioritize-restic-s-io-and-cpu-time restic FAQ] for more information. ==== Excludes list ==== Add the excludes file under {{ic|/etc/restic}} e.g.: {{hc|/etc/restic/excludes.txt| /data/** /dev/** /home/*/**/*.pyc /home/*/**/__pycache__/** /home/*/**/node_modules/** /home/*/.cache/** /home/*/.local/lib/python*/site-packages/** /home/*/.mozilla/firefox/*/Cache/** /lost+found/** /media/** /mnt/** /proc/** /root/** /run/** /swapfile /sys/** /tmp/** /var/cache/** /var/cache/pacman/pkg/** /var/lib/docker/** /var/lib/libvirt/** /var/lock/** /var/log/** /var/run/** }} ==== Enable ==== Do not forget to [[enable]] the {{ic|restic-backup.timer}}.
このページで使用されているテンプレート:
テンプレート:AUR
(
ソースを閲覧
)
テンプレート:Hc
(
ソースを閲覧
)
テンプレート:Ic
(
ソースを閲覧
)
テンプレート:META Related articles start
(
ソースを閲覧
)
テンプレート:Man
(
ソースを閲覧
)
テンプレート:Note
(
ソースを閲覧
)
テンプレート:Pkg
(
ソースを閲覧
)
テンプレート:Related
(
ソースを閲覧
)
テンプレート:Related articles end
(
ソースを閲覧
)
テンプレート:Related articles start
(
ソースを閲覧
)
Restic
に戻る。
検索
検索
Resticのソースを表示
話題を追加