惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
Hacker News - Newest:
Hacker News - Newest: "LLM"
雷峰网
雷峰网
人人都是产品经理
人人都是产品经理
Last Week in AI
Last Week in AI
爱范儿
爱范儿
美团技术团队
V
Visual Studio Blog
P
Proofpoint News Feed
GbyAI
GbyAI
Y
Y Combinator Blog
博客园 - 司徒正美
IT之家
IT之家
Google DeepMind News
Google DeepMind News
F
Full Disclosure
aimingoo的专栏
aimingoo的专栏
宝玉的分享
宝玉的分享
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园_首页
M
MIT News - Artificial intelligence
V
V2EX
C
CXSECURITY Database RSS Feed - CXSecurity.com
A
Arctic Wolf
B
Blog
P
Proofpoint News Feed
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The GitHub Blog
The GitHub Blog
SecWiki News
SecWiki News
I
Intezer
P
Palo Alto Networks Blog
S
Security Affairs
L
LangChain Blog
C
Cisco Blogs
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
Martin Fowler
Martin Fowler
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Webroot Blog
Webroot Blog
Schneier on Security
Schneier on Security
Spread Privacy
Spread Privacy
H
Heimdal Security Blog
有赞技术团队
有赞技术团队
量子位
D
Docker
S
Secure Thoughts
N
News | PayPal Newsroom
The Last Watchdog
The Last Watchdog
H
Hacker News: Front Page
H
Hackread – Cybersecurity News, Data Breaches, AI and More

东东's Blog

Memos: MacOS 下编译安装 Aseprite 脚本 日本关西系列|Day 2 京都的半日闲逛 美国Apple官网购买礼品卡订阅 ChatGPT Plus 北京・中关村森林公园(2026) 日本关西系列|Day 1 抵达临空城与大阪首日 Memos: 查询 Apple ID 注册时间 Memos: Ghostty 开箱即用配置 代码考古:用 gitcharts 挖掘 Git 仓库的演变轨迹 烹饪日记:香煎罗非鱼 Memos: 新时代程序员的顶级焦虑 Memos: 博客新增图文布局和轮播图效果支持 Memos: 最适合空气炸锅烤着吃的红薯品类 Memos: 记录「95分」好吃的‘小帅香菇面’ 妻子爷爷的‘朝鲜军功奖章’ Memos: 博客切换为 Shiki 代码高亮方案 Memos: 博客新增划线、重点及荧光笔效果支持 记录博客字体分包与字体子集化 Memos: 邻座吃饭的一家三口 人在囧途之哈囧 哈尔滨・乡村的冬季 查看香烟生产日期 哈尔滨・东北虎林园 Memos: 来自日本的 ndjp 提供免费的三级子域名 Memos: 刚听说 autojump, 真的好用 Memos: 体验 OpenCode + Superpowers + GPT 5.2 开发需求 Memos: 杰我睿爆雷 GoReleaser 自动发布 Go 镜像到 DockerHub & GitHub Release 初识 Volta & Corepack 前端版本管理工具 部署 Beszel 把 “小鸡们” 归拢起来 Memos: Claude Code in Action 中文版教程 2025 年度回顾 Memos: 体验 tanaos-text-anonymizer-v1 NER 模型 Memos: 查询 Google 账号注册时间 Memos: 关于 Z30 在室内摄像被手机降维打击这点儿事儿 阅读《我与地坛》 Memos: Ghostty + Neovim + LazyVim Memos: 找到 Cursor 运行巨慢的一个原因 Memos: 京东家政 哈尔滨灵活就业人员医保退休待遇申领条件 记地暖不热的维修过程 Memos: 赛博菩萨 Cloudflare 又挂了 AnyTLS 软件的配置与使用 阅读《在巴东》 Memos: Web Archive 暂时离线 忆时光:十五年前我的家(动迁前夕) macOS 系统部署 Valkey 集群模式 阅读《一个名叫欧维的男人决定去死》 Memos: Cursor 服务故障部分功能不可用 阅读《丰乳肥臀》 爱人回家送奶奶 Memos: AWS 美东可用区 P0 故障(us-east-1) 2025 北京社保下限上调|个体户缴费随之上涨 铁锅重生记 不锈钢盆与放心水源改造计划 阅读《不被大风吹倒》 基于 Supabase 构建示例应用(中篇):实现 Vue 前端页面 基于 Supabase 构建示例应用(上篇):数据库与接口 阅读《三体》之地球往事 Oracle Free 实例重装系统 非京籍个体户缴纳社保(补充):“无有效的汇总预处理信息” 解决办法 阅读《芯片简史》 阅读《简约至上:交互式设计四策略(第2版)》 阅读《审判》 阅读《统计数字会撒谎》 达达秒送骑士 日本关西系列|在动物园前站找到海南本线 观影《长安的荔枝》 Memos: 记录两个在线工具 地球 Online:外卖骑手体验报告 杜师傅夜话:附身与归途 日本关西系列|使用投放硬币的行李寄存箱 日本关西系列|将多余零钱充值到西瓜卡 日本关西系列|网上购买大阪往返白滨高速巴士 乌鲁木齐・赛里木湖 “778 老哥” 摄影摘选(转载) 使用 Restic 来备份重要数据 Sauvegarder des données importantes avec Restic Resticで重要なデータをバックアップする Cursor 开发 Obsidian 插件记录 非京籍个体户缴纳社保(十):新增并缴纳个人所得税-工资薪金 非京籍个体户缴纳社保(九):公积金开户增员与缴费 非京籍个体户缴纳社保(八):税务申报与工商年报 非京籍个体户缴纳社保(七):社保费用申报与缴纳 非京籍个体户缴纳社保(六):医保公共服务平台 - 增员确认 非京籍个体户缴纳社保(五):北京电子税务局 - 税务报道 非京籍个体户缴纳社保(四):北京市社会保险网上服务平台 - 增员与社保卡领取 非京籍个体户缴纳社保(三):社会保险网上服务平台 - 单位信息登记 非京籍个体户缴纳社保(二):北京 e 窗通平台提交申请 非京籍个体户缴纳社保(一):概览与先期准备 养老保险零基础入门指南(速通版) 了解北京门诊看病工会“二次报销”互助金 注册 US.KG 免费域名(dpdns.org) 白嫖 Cloudflare R2 + Worker 搭建私有镜像仓库 再思 JWT 的使用场景和算法选择 黑龙江・木兰县属小村落的星空(2024) Nginx 启用 HTTPS/3 优化网站的 SSL Labs 总体评级为 A+(禁用旧协议 & 启用 HSTS) 了解 OCSP Stapling 证书吊销验证机制 山东・烟台中秋两三日(2024) 分享改造后的博客发布流程和访问链路 边缘网络:白嫖 Cloudflare R2 博客图床(DNS 国内外分流)
Backing Up Important Data with Restic
2025-04-03 · via 东东's Blog

I had been using Cryptomator for quite a long time to manage my content. Its advantage is that local data also requires a password to access. After encryption, the content can be placed on sync drives like Nutstore, Dropbox, etc., and uploaded to the cloud in real-time after each file addition or modification.

If you're storing content that doesn't need editing and you mainly add or replace resources, I would still highly recommend trying Cryptomator. It's well-suited for saving electronic scans, images, and spreadsheet documents.

However, on macOS, if you use software like Obsidian to manage your knowledge base and frequently need to edit content, editing text files after decrypting with Cryptomator becomes quite unfriendly. To avoid issues, when editing plain text files, I had to copy them out, edit them, and then replace the original files, which was quite cumbersome.

I happened to learn about Restic. If you want to encrypt and backup your Obsidian or other note-taking software vaults and upload them to cloud drives or S3-compatible platforms, then Restic is perfect for that.

Quick Start

Installing Restic

macOS

$ brew install restic

It supports mainstream operating systems. For details, see: https://restic.readthedocs.io/en/latest/020_installation.html

Initializing a Local Repository

Simply put, a repository is a folder for storing encrypted files. The initialization process generates some metadata.

$ restic init --repo ~/Documents/NoteE2EE
enter password for new repository:
enter password again:
created restic repository 0a40262533 at /Users/xxxxx/Documents/NoteE2EE

Please note that knowledge of your password is required to access
the repository. Losing your password means that your data is
irrecoverably lost.

Remember your password. Once forgotten, there's no way to decrypt the data.

Backing Up Data

Execute the command to back up the ~/Note folder to the ~/Documents/NoteE2EE repository.

$ restic -r ~/Documents/NoteE2EE backup ~/Documents/Note

On the first run, you can see the number of files and directories backed up, and the "snapshot" ID is displayed.

The command can be run multiple times (each run creates a snapshot).

Since it creates incremental backups, you don't need to worry about snapshots taking up too much space.

Use the following command to view the list of snapshots in the repository:

$ restic -r ~/Documents/NoteE2EE snapshots

This repository folder "NoteE2EE" contains encrypted content. Following the 3-2-1 principle, it can be safely stored on local hard drives, external drives, and cloud storage without worrying about data leaks.

Optimizing Backup Command Parameters

$ restic -r ~/Documents/NoteE2EE backup ~/Documents/Note \
    --pack-size 32 \
    --exclude="*.tmp" \
    --iexclude="*.LOG" \
    --limit-upload 1024 \
    --json

Good use of the --pack-size parameter can effectively control the number of target files, preventing large files from being split into too many small files. Historical files won't be affected; it only impacts the current incremental backup.

Corresponding to --limit-upload, there's a --limit-download parameter for limiting download speed.

If you're developing small tools based on Restic, the --json parameter is quite necessary:

{"message_type":"status","percent_done":0,"total_files":29,"total_bytes":204482794}
{"message_type":"status","percent_done":0,"total_files":41,"total_bytes":333776710}
{"message_type":"status","percent_done":0,"total_files":41,"total_bytes":333776710}
{"message_type":"status","percent_done":0,"total_files":41,"total_bytes":333776710}
{"message_type":"status","percent_done":0,"total_files":41,"total_bytes":333776710}
{"message_type":"status","percent_done":0,"total_files":41,"total_bytes":333776710}
{"message_type":"status","percent_done":0,"total_files":41,"total_bytes":333776710}
{"message_type":"status","percent_done":0.2808864315308279,"total_files":41,"files_done":13,"total_bytes":333776710,"bytes_done":93753349}
{"message_type":"status","percent_done":1,"total_files":41,"files_done":41,"total_bytes":333776710,"bytes_done":333776710}
{"message_type":"summary","files_new":0,"files_changed":0,"files_unmodified":41,"dirs_new":0,"dirs_changed":2,"dirs_unmodified":8,"data_blobs":0,"tree_blobs":2,"data_added":756,"data_added_packed":608,"total_files_processed":41,"total_bytes_processed":333776710,"total_duration":5.552792709,"backup_start":"2025-04-02T18:30:04.949151+08:00","backup_end":"2025-04-02T18:30:10.501995+08:00","snapshot_id":"74e465ed71f7fb5b7abb562d4cb9d067f20d89a1a9f3ed4ed32a0bc73e8abab1"}

Based on this data, you can create progress bars and display the volume of backed-up files.

More Backend Storage Types

Using the command restic init --repo ~/Documents/NoteE2EE, we created a local repository.

Below is an example of an S3-compatible storage:

# Setting environment variables
$ export AWS_ACCESS_KEY_ID=id7O9M0H****tXJ2romrN
$ export AWS_SECRET_ACCESS_KEY=bFA0dL0u********ndnxVcrwPh31u
$ export AWS_DEFAULT_REGION=cn-east-1

# Initializing repository and backup
$ restic -r s3:https://s3.bitiful.net/note-e2ee init
$ restic -r s3:https://s3.bitiful.net/note-e2ee --verbose backup ~/Documents/NoteE2EE

Note: If the AWS_DEFAULT_REGION environment variable is not set, us-east-1 will be used as the default value.

For other platforms and storage options like Amazon S3, Backblaze B2, Google Cloud, etc., refer to the documentation: https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html

Snapshot Management

Keeping Recent Snapshots

We might run backup on a schedule, but too many backups can be overwhelming. Run the following command to keep only the 7 most recent snapshots:

$ restic -r [repository path] forget --keep-last 7 --prune

Snapshot Tags

You can specify multiple tags when backing up (--tag "v1.0" --tag "daily"):

$ restic -r ~/Documents/NoteE2EE backup --tag "v1.0" ~/Documents/Note

You can also modify tags for existing snapshots:

# Add a tag
$ restic -r ~/Documents/NoteE2EE tag --add "important" 8c5c9d50

# Remove a tag
$ restic -r ~/Documents/NoteE2EE tag --remove "important" 43547193

# Set multiple tags
$ restic -r ~/Documents/NoteE2EE tag --set "important,project2" a1ff1a78

It's worth noting that after each modification, the snapshot ID will change.

Verifying Backup Integrity

Backups stored in the cloud can't guarantee 100% file preservation or prevent damage. You can verify integrity using the check command:

$ restic -r ~/Documents/NoteE2EE check

04.jpg

Now let's simulate "damage". For example, find a file in the data directory within the NoteE2EE directory, modify its filename by adding an underscore at the beginning to simulate file damage/loss.

Running the check command again shows that the repository is abnormal and needs repair, which is expected.

06.jpg

Restoring Snapshots to a Specific Directory

View existing snapshots:

$ restic -r ~/Documents/NoteE2EE snapshots

Export a specific snapshot:

$ restic -r ~/Documents/NoteE2EE restore 5fcd966f --target ~/Downloads/NoteRestore/

5fcd966f is the snapshot ID, which can be found using the snapshots command; additionally, the NoteRestore directory will be created automatically if it doesn't exist.

If your repository is large and you only want to export certain files or directories, use the following command:

$ restic -r ~/Documents/NoteE2EE restore 5fcd966f --target ~/Downloads/NoteRestore/ --include Epub电子书

In this case, "--include Epub电子书" refers to a folder in the root directory of the repository.

Using "copy" Instead of "backup"

If you only have one encrypted repository, using backup each time works fine. However, if you follow the 3-2-1 principle for backups and have multiple encrypted repositories, running backup multiple times to different repositories is inefficient.

In this case, you need to use copy, which ensures strict data consistency and performs well:

$ restic init --repo ~/Documents/NoteE2EE-copy

$ restic -r ~/Documents/NoteE2EE-copy copy --from-repo ~/Documents/NoteE2EE

From an AI summary (which I think is quite good):

If you need to synchronize data between multiple Restic repositories, copy is always the preferred choice—it acts like a professional "data mover" between repositories, while backup is like a "collector" for original data.

Give Restic Browser a Try

If you're not a fan of command-line operations, you can try this open-source tool: emuell/restic-browser

07.jpg

Developed with Rust + TypeScript, it's only a few megabytes in size and has read-only functionality. As the name "Browser" suggests, it allows you to browse encrypted repositories and makes it more convenient to look for files in snapshots.

You Might Also Need Autorestic

Documentation: Autorestic Quick Start

Autorestic is a wrapper around the amazing restic. While being amazing the restic cli can be a bit overwhelming and difficult to manage if you have many different location that you want to backup to multiple locations. This utility is aimed at making this easier 🙂

Autorestic is a wrapper developed around the excellent restic tool. Although the restic command-line tool itself is outstanding, when you need to synchronize backup data from multiple different locations to multiple storage targets, its operation can seem complex and difficult to manage. This tool aims to simplify this process, making multi-target backup management easier and more convenient.

Installation

$ brew install autorestic

Configuration File

Create a configuration file with the following content:

version: 2
backends:
  note_primary:
    type: local
    path: "~/Documents/NoteE2EE"
    env:
      RESTIC_PASSWORD: "your-restic-vault-passowrd"
  note_backup:
    type: local
    path: "~/Documents/NoteE2EE-copy"
    env:
      RESTIC_PASSWORD: "your-restic-vault-passowrd"

locations:
  notes:
    from: "~/Documents/Note"
    to:
      - note_primary
      - note_backup
    options:
      forget:
        keep-last: 7

Change the configuration file permissions (recommended):

$ chmod 600 ~/.autorestic.yml

Locations and Backends

In Autorestic, Location describes the backup content and target (from / to), and Backend defines the backup destination.

Configuration Verification

$ autorestic check

Everything is fine.

Manual Backup Execution

Complete backup:

$ autorestic backup -a

Specific Location backup:

$ autorestic backup -l notes

Output:

Currently, this solution perfectly fits my needs and is easy to use. I'll update this post with any additional information after using it for a while.

References