Skip to content

feat: add b2 repository backend type#726

Open
WitherCOM wants to merge 2 commits intonicotsx:mainfrom
WitherCOM:feature/add-b2-repository-backend-type
Open

feat: add b2 repository backend type#726
WitherCOM wants to merge 2 commits intonicotsx:mainfrom
WitherCOM:feature/add-b2-repository-backend-type

Conversation

@WitherCOM
Copy link
Copy Markdown

Restic natively supports backblaze b2 repositories. I implemented the handling of this new repository backend.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 91d245cc-06b3-471e-addc-9f531879bada

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dosubot
Copy link
Copy Markdown

dosubot bot commented Apr 1, 2026

Related Documentation

1 document(s) may need updating based on files changed in this PR:

Zerobyte's Space

Repositories in Zerobyte: Types, Architecture, and Operations
View Suggested Changes
@@ -4,7 +4,7 @@
 [Repositories are storage locations where encrypted backups are securely stored](https://github.com/nicotsx/zerobyte/blob/bad944a2329540088a51f7699d6f53d9ac82137c/README.md#L192-L200). They serve as the destination for backup data and leverage Restic's deduplication and encryption features for storage efficiency and data integrity.
 
 ## Repository Types
-Zerobyte supports [8 different repository backend types](https://github.com/nicotsx/zerobyte/blob/bad944a2329540088a51f7699d6f53d9ac82137c/packages/core/src/restic/schemas.ts#L104-L113), each designed for different storage scenarios:
+Zerobyte supports [9 different repository backend types](https://github.com/nicotsx/zerobyte/blob/bad944a2329540088a51f7699d6f53d9ac82137c/packages/core/src/restic/schemas.ts#L104-L113), each designed for different storage scenarios:
 
 ### 1. Local (`local`)
 [Stores backups on local disk](https://github.com/nicotsx/zerobyte/blob/bad944a2329540088a51f7699d6f53d9ac82137c/packages/core/src/restic/schemas.ts#L59-L62) in a subfolder of `/var/lib/zerobyte/repositories/` or any other mounted path.
@@ -36,7 +36,17 @@
 - `accessKeyId`: Access key (encrypted)
 - `secretAccessKey`: Secret key (encrypted)
 
-### 4. GCS (`gcs`)
+### 4. B2 (`b2`)
+[Backblaze B2 storage](https://github.com/nicotsx/zerobyte/blob/bad944a2329540088a51f7699d6f53d9ac82137c/packages/core/src/restic/schemas.ts), natively supported by Restic
+
+**Configuration:**
+- `backend`: `'b2'`
+- `bucket`: Bucket name
+- `path`: Path inside bucket
+- `accountId`: Account ID (encrypted)
+- `accountKey`: Account key (encrypted)
+
+### 5. GCS (`gcs`)
 [Google Cloud Storage](https://github.com/nicotsx/zerobyte/blob/bad944a2329540088a51f7699d6f53d9ac82137c/packages/core/src/restic/schemas.ts#L64-L69)
 
 **Configuration:**
@@ -45,7 +55,7 @@
 - `projectId`: GCP project ID
 - `credentialsJson`: Service account credentials (encrypted)
 
-### 5. Azure (`azure`)
+### 6. Azure (`azure`)
 [Microsoft Azure Blob Storage](https://github.com/nicotsx/zerobyte/blob/bad944a2329540088a51f7699d6f53d9ac82137c/packages/core/src/restic/schemas.ts#L71-L77)
 
 **Configuration:**
@@ -55,7 +65,7 @@
 - `accountKey`: Account key (encrypted)
 - `endpointSuffix`: Optional endpoint suffix
 
-### 6. rclone (`rclone`)
+### 7. rclone (`rclone`)
 [Support for 40+ cloud storage providers via rclone](https://github.com/nicotsx/zerobyte/blob/bad944a2329540088a51f7699d6f53d9ac82137c/packages/core/src/restic/schemas.ts#L79-L83) (Google Drive, Dropbox, OneDrive, Box, pCloud, Mega, etc.)
 
 **Configuration:**
@@ -64,7 +74,7 @@
 - `path`: Path within remote
 - `insecureTls`: Optional flag to disable TLS certificate validation
 
-### 7. REST (`rest`)
+### 8. REST (`rest`)
 [REST server backend](https://github.com/nicotsx/zerobyte/blob/bad944a2329540088a51f7699d6f53d9ac82137c/packages/core/src/restic/schemas.ts#L85-L91)
 
 **Configuration:**
@@ -74,7 +84,7 @@
 - `password`: Optional password (encrypted)
 - `path`: Optional path
 
-### 8. SFTP (`sftp`)
+### 9. SFTP (`sftp`)
 [SSH File Transfer Protocol](https://github.com/nicotsx/zerobyte/blob/bad944a2329540088a51f7699d6f53d9ac82137c/packages/core/src/restic/schemas.ts#L93-L102)
 
 **Configuration:**
@@ -245,6 +255,7 @@
 - **Local**: `config.path`
 - **S3**: `s3:endpoint/bucket` (where `endpoint` is trimmed of whitespace and trailing slash)
 - **R2**: `s3:endpoint/bucket` (where `endpoint` is trimmed of whitespace and trailing slash, and protocol is removed)
+- **B2**: `b2:bucket:path` (for example: `b2:my-backup-bucket:/backups`)
 - **GCS**: `gs:bucket:/`
 - **Azure**: `azure:container:/`
 - **rclone**: `rclone:remote:path`
@@ -263,6 +274,10 @@
 - `AWS_SECRET_ACCESS_KEY`
 - `AWS_REGION` (R2: "auto")
 - `AWS_S3_FORCE_PATH_STYLE` (R2: "true")
+
+**B2:**
+- `B2_ACCOUNT_ID`
+- `B2_ACCOUNT_KEY`
 
 **GCS:**
 - `GOOGLE_PROJECT_ID`

[Accept] [Decline]

Note: You must be authenticated to accept/decline updates.

How did I do? Any feedback?  Join Discord

@nicotsx
Copy link
Copy Markdown
Owner

nicotsx commented Apr 1, 2026

Thank you for the pull request @WitherCOM I have decided to not add native B2 support because of this warning on the restic docs

image

Do you have issues using B2 with S3 compatible API?

@WitherCOM
Copy link
Copy Markdown
Author

I haven't found any problem with that way, but I think for a single person this Backblaze is the cheapest among offsite backups. I hope one day restic will patch the bug with this backend. Although I am using restic for a year now and I haven't got any errors with b2. Are you still want to drop this feature?

@nicotsx
Copy link
Copy Markdown
Owner

nicotsx commented Apr 1, 2026

Not saying I want to drop it but maybe we can keep the B2 UI and in the backend simply map this to a normal S3 if it makes sense. B2 is already supported but with the s3 compatible access key

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants