2015-11-27 18:25:52 +00:00
---
title: "B2"
description: "Backblaze B2"
2022-11-17 17:56:24 +00:00
versionIntroduced: "v1.26"
2015-11-27 18:25:52 +00:00
---
2021-07-20 18:45:41 +00:00
# {{< icon "fa fa-fire" >}} Backblaze B2
2015-11-27 18:25:52 +00:00
2024-05-23 15:23:57 +00:00
B2 is [Backblaze's cloud storage system ](https://www.backblaze.com/cloud-storage ).
2015-11-27 18:25:52 +00:00
Paths are specified as `remote:bucket` (or `remote:` for the `lsd`
2020-10-13 21:49:58 +00:00
command.) You may put subdirectories in too, e.g. `remote:bucket/path/to/dir` .
2015-11-27 18:25:52 +00:00
2021-10-14 13:40:18 +00:00
## Configuration
2015-11-27 18:25:52 +00:00
Here is an example of making a b2 configuration. First run
rclone config
2019-02-09 09:00:05 +00:00
This will guide you through an interactive setup process. To authenticate
you will either need your Account ID (a short hex number) and Master
Application Key (a long hex number) OR an Application Key, which is the
recommended method. See below for further details on generating and using
an Application Key.
2015-11-27 18:25:52 +00:00
```
2021-11-01 20:34:46 +00:00
No remotes found, make a new one?
2015-11-27 18:25:52 +00:00
n) New remote
q) Quit config
n/q> n
name> remote
2016-02-21 13:39:04 +00:00
Type of storage to configure.
Choose a number from below, or type in your own value
2019-08-26 09:47:17 +00:00
[snip]
XX / Backblaze B2
2016-02-21 13:39:04 +00:00
\ "b2"
2019-08-26 09:47:17 +00:00
[snip]
Storage> b2
2018-08-01 13:33:01 +00:00
Account ID or Application Key ID
2015-11-27 18:25:52 +00:00
account> 123456789abc
Application Key
key> 0123456789abcdef0123456789abcdef0123456789
Endpoint for the service - leave blank normally.
2017-01-09 05:09:19 +00:00
endpoint>
2015-11-27 18:25:52 +00:00
Remote config
--------------------
[remote]
account = 123456789abc
key = 0123456789abcdef0123456789abcdef0123456789
2017-01-09 05:09:19 +00:00
endpoint =
2015-11-27 18:25:52 +00:00
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
```
This remote is called `remote` and can now be used like this
See all buckets
rclone lsd remote:
2018-07-30 22:14:03 +00:00
Create a new bucket
2015-11-27 18:25:52 +00:00
rclone mkdir remote:bucket
List the contents of a bucket
rclone ls remote:bucket
Sync `/home/local/directory` to the remote bucket, deleting any
excess files in the bucket.
2023-01-20 20:47:36 +00:00
rclone sync --interactive /home/local/directory remote:bucket
2015-11-27 18:25:52 +00:00
2021-10-14 13:40:18 +00:00
### Application Keys
2018-08-01 13:33:01 +00:00
B2 supports multiple [Application Keys for different access permission
2024-05-23 15:23:57 +00:00
to B2 Buckets](https://www.backblaze.com/docs/cloud-storage-application-keys).
2018-08-01 13:33:01 +00:00
2019-01-01 19:52:43 +00:00
You can use these with rclone too; you will need to use rclone version 1.43
or later.
2018-08-01 13:33:01 +00:00
Follow Backblaze's docs to create an Application Key with the required
2019-02-09 09:00:05 +00:00
permission and add the `applicationKeyId` as the `account` and the
2018-08-01 13:33:01 +00:00
`Application Key` itself as the `key` .
2019-02-09 09:00:05 +00:00
Note that you must put the _applicationKeyId_ as the `account` – you
2018-08-01 13:33:01 +00:00
can't use the master Account ID. If you try then B2 will return 401
errors.
2021-10-14 13:40:18 +00:00
### --fast-list
2017-06-06 15:40:00 +00:00
This remote supports `--fast-list` which allows you to use fewer
transactions in exchange for more memory. See the [rclone
docs](/docs/#fast-list) for more details.
2023-11-18 12:36:46 +00:00
### Modification times
2015-11-27 18:25:52 +00:00
2023-11-18 12:36:46 +00:00
The modification time is stored as metadata on the object as
2015-11-27 18:25:52 +00:00
`X-Bz-Info-src_last_modified_millis` as milliseconds since 1970-01-01
in the Backblaze standard. Other tools should be able to use this as
a modified time.
2019-05-24 15:07:22 +00:00
Modified times are used in syncing and are fully supported. Note that
if a modification time needs to be updated on an object then it will
create a new version of the object.
2015-11-27 18:25:52 +00:00
2021-10-14 13:40:18 +00:00
### Restricted filename characters
2018-11-02 12:14:43 +00:00
In addition to the [default restricted characters set ](/overview/#restricted-characters )
the following characters are also replaced:
| Character | Value | Replacement |
| --------- |:-----:|:-----------:|
| \ | 0x5C | \ |
Invalid UTF-8 bytes will also be [replaced ](/overview/#invalid-utf8 ),
as they can't be used in JSON strings.
2020-07-06 15:28:30 +00:00
Note that in 2020-05 Backblaze started allowing \ characters in file
names. Rclone hasn't changed its encoding as this could cause syncs to
re-transfer files. If you want rclone not to replace \ then see the
`--b2-encoding` flag below and remove the `BackSlash` from the
string. This can be set in the config.
2021-10-14 13:40:18 +00:00
### SHA1 checksums
2015-11-27 18:25:52 +00:00
2016-01-13 10:29:43 +00:00
The SHA1 checksums of the files are checked on upload and download and
2016-07-13 13:50:47 +00:00
will be used in the syncing process.
2015-11-27 18:25:52 +00:00
2017-11-03 12:49:15 +00:00
Large files (bigger than the limit in `--b2-upload-cutoff` ) which are
uploaded in chunks will store their SHA1 on the object as
`X-Bz-Info-large_file_sha1` as recommended by Backblaze.
For a large file to be uploaded with an SHA1 checksum, the source
needs to support SHA1 checksums. The local disk supports SHA1
checksums so large file transfers from local disk will have an SHA1.
See [the overview ](/overview/#features ) for exactly which remotes
support SHA1.
Sources which don't support SHA1, in particular `crypt` will upload
large files without SHA1 checksums. This may be fixed in the future
2019-07-28 17:47:38 +00:00
(see [#1767 ](https://github.com/rclone/rclone/issues/1767 )).
2017-11-03 12:49:15 +00:00
Files sizes below `--b2-upload-cutoff` will always have an SHA1
regardless of the source.
2016-06-15 17:49:11 +00:00
2021-10-14 13:40:18 +00:00
### Transfers
2016-07-05 10:26:02 +00:00
Backblaze recommends that you do lots of transfers simultaneously for
2017-10-28 06:03:51 +00:00
maximum speed. In tests from my SSD equipped laptop the optimum
2016-07-05 10:26:02 +00:00
setting is about `--transfers 32` though higher numbers may be used
for a slight speed improvement. The optimum number for you may vary
depending on your hardware, how big the files are, how much you want
to load your computer, etc. The default of `--transfers 4` is
definitely too low for Backblaze B2 though.
2021-03-02 19:11:57 +00:00
Note that uploading big files (bigger than 200 MiB by default) will use
a 96 MiB RAM buffer by default. There can be at most `--transfers` of
2016-07-13 13:50:47 +00:00
these in use at any moment, so this sets the upper limit on the memory
used.
2021-10-14 13:40:18 +00:00
### Versions
2015-11-27 18:25:52 +00:00
When rclone uploads a new version of a file it creates a [new version
2024-05-23 15:23:57 +00:00
of it](https://www.backblaze.com/docs/cloud-storage-file-versions).
2017-07-23 12:02:42 +00:00
Likewise when you delete a file, the old version will be marked hidden
and still be available. Conversely, you may opt in to a "hard delete"
of files with the `--b2-hard-delete` flag which would permanently remove
the file instead of hiding it.
2015-11-27 18:25:52 +00:00
2017-07-23 12:02:42 +00:00
Old versions of files, where available, are visible using the
`--b2-versions` flag.
2015-11-27 18:25:52 +00:00
2022-03-15 03:55:20 +00:00
It is also possible to view a bucket as it was at a certain point in time,
using the `--b2-version-at` flag. This will show the file versions as they
were at that time, showing files that have been deleted afterwards, and
hiding files that were created since.
2024-03-01 00:49:34 +00:00
If you wish to remove all the old versions, and unfinished large file
uploads, then you can use the `rclone cleanup remote:bucket` command
which will delete all the old versions of files, leaving the current ones
intact. You can also supply a path and only old versions under that path
will be deleted, e.g. `rclone cleanup remote:bucket/path/to/stuff` .
2016-07-02 16:03:08 +00:00
2018-12-02 18:05:32 +00:00
Note that `cleanup` will remove partially uploaded files from the bucket
2024-03-01 00:49:34 +00:00
if they are more than a day old. If you want more control over the
expiry date then run `rclone backend cleanup b2:bucket -o max-age=1h`
to remove all unfinished large file uploads older than one hour, leaving
old versions intact.
If you wish to remove all the old versions, leaving current files and
unfinished large files intact, then you can use the
[`rclone backend cleanup-hidden remote:bucket` ](#cleanup-hidden )
command. You can also supply a path and only old versions under that
path will be deleted, e.g.
`rclone backend cleanup-hidden remote:bucket/path/to/stuff` .
2018-09-29 13:47:31 +00:00
2016-07-05 10:26:02 +00:00
When you `purge` a bucket, the current and the old versions will be
deleted then the bucket will be deleted.
2015-11-27 18:25:52 +00:00
2016-07-05 10:26:02 +00:00
However `delete` will cause the current versions of the files to
become hidden old versions.
2016-04-04 16:58:36 +00:00
2017-10-28 06:03:51 +00:00
Here is a session showing the listing and retrieval of an old
2016-07-05 10:26:02 +00:00
version followed by a `cleanup` of the old versions.
Show current version and all the versions with `--b2-versions` flag.
```
$ rclone -q ls b2:cleanup-test
9 one.txt
$ rclone -q --b2-versions ls b2:cleanup-test
9 one.txt
8 one-v2016-07-04-141032-000.txt
16 one-v2016-07-04-141003-000.txt
15 one-v2016-07-02-155621-000.txt
```
2017-10-28 06:03:51 +00:00
Retrieve an old version
2016-07-05 10:26:02 +00:00
```
$ rclone -q --b2-versions copy b2:cleanup-test/one-v2016-07-04-141003-000.txt /tmp
$ ls -l /tmp/one-v2016-07-04-141003-000.txt
-rw-rw-r-- 1 ncw ncw 16 Jul 2 17:46 /tmp/one-v2016-07-04-141003-000.txt
```
Clean up all the old versions and show that they've gone.
```
$ rclone -q cleanup b2:cleanup-test
$ rclone -q ls b2:cleanup-test
9 one.txt
$ rclone -q --b2-versions ls b2:cleanup-test
9 one.txt
```
2016-04-04 16:58:36 +00:00
2023-07-27 07:06:50 +00:00
#### Versions naming caveat
When using `--b2-versions` flag rclone is relying on the file name
to work out whether the objects are versions or not. Versions' names
are created by inserting timestamp between file name and its extension.
```
9 file.txt
8 file-v2023-07-17-161032-000.txt
16 file-v2023-06-15-141003-000.txt
```
If there are real files present with the same names as versions, then
behaviour of `--b2-versions` can be unpredictable.
2021-10-14 13:40:18 +00:00
### Data usage
2016-10-25 20:36:45 +00:00
It is useful to know how many requests are sent to the server in different scenarios.
All copy commands send the following 4 requests:
```
/b2api/v1/b2_authorize_account
/b2api/v1/b2_create_bucket
/b2api/v1/b2_list_buckets
/b2api/v1/b2_list_file_names
```
The `b2_list_file_names` request will be sent once for every 1k files
in the remote path, providing the checksum and modification time of
the listed files. As of version 1.33 issue
2019-07-28 17:47:38 +00:00
[#818 ](https://github.com/rclone/rclone/issues/818 ) causes extra requests
2016-10-25 20:36:45 +00:00
to be sent when using B2 with Crypt. When a copy operation does not
require any files to be uploaded, no more requests will be sent.
Uploading files that do not require chunking, will send 2 requests per
file upload:
```
/b2api/v1/b2_get_upload_url
/b2api/v1/b2_upload_file/
```
Uploading files requiring chunking, will send 2 requests (one each to
start and finish the upload) and another 2 requests for each chunk:
```
/b2api/v1/b2_start_large_file
/b2api/v1/b2_get_upload_part_url
/b2api/v1/b2_upload_part/
/b2api/v1/b2_finish_large_file
```
2021-10-14 13:40:18 +00:00
#### Versions
2016-06-15 17:49:11 +00:00
2019-03-27 19:12:24 +00:00
Versions can be viewed with the `--b2-versions` flag. When it is set
2018-10-01 17:36:15 +00:00
rclone will show and act on older versions of files. For example
2016-07-05 10:26:02 +00:00
Listing without `--b2-versions`
```
$ rclone -q ls b2:cleanup-test
9 one.txt
```
And with
```
$ rclone -q --b2-versions ls b2:cleanup-test
9 one.txt
8 one-v2016-07-04-141032-000.txt
16 one-v2016-07-04-141003-000.txt
15 one-v2016-07-02-155621-000.txt
```
Showing that the current version is unchanged but older versions can
be seen. These have the UTC date that they were uploaded to the
server to the nearest millisecond appended to them.
Note that when using `--b2-versions` no file write operations are
permitted, so you can't upload files or delete them.
2018-10-01 17:36:15 +00:00
2021-10-14 13:40:18 +00:00
### B2 and rclone link
2019-07-25 07:53:51 +00:00
Rclone supports generating file share links for private B2 buckets.
They can either be for a file for example:
```
./rclone link B2:bucket/path/to/file.txt
https://f002.backblazeb2.com/file/bucket/path/to/file.txt?Authorization=xxxxxxxx
```
or if run on a directory you will get:
```
./rclone link B2:bucket/path
https://f002.backblazeb2.com/file/bucket/path?Authorization=xxxxxxxx
```
you can then use the authorization token (the part of the url from the
`?Authorization=` on) on any file path under that directory. For example:
```
https://f002.backblazeb2.com/file/bucket/path/to/file1?Authorization=xxxxxxxx
https://f002.backblazeb2.com/file/bucket/path/file2?Authorization=xxxxxxxx
https://f002.backblazeb2.com/file/bucket/path/folder/file3?Authorization=xxxxxxxx
```
2020-05-22 11:22:52 +00:00
{{< rem autogenerated options start " - DO NOT EDIT - instead edit fs . RegInfo in backend / b2 / b2 . go then run make backenddocs " > }}
2021-11-01 15:42:05 +00:00
### Standard options
2018-10-01 19:48:54 +00:00
2022-07-09 17:08:20 +00:00
Here are the Standard options specific to b2 (Backblaze B2).
2018-10-01 19:48:54 +00:00
#### --b2-account
2021-11-01 15:42:05 +00:00
Account ID or Application Key ID.
2018-10-01 19:48:54 +00:00
2022-03-18 12:29:54 +00:00
Properties:
2018-10-01 19:48:54 +00:00
- Config: account
- Env Var: RCLONE_B2_ACCOUNT
- Type: string
2022-03-18 12:29:54 +00:00
- Required: true
2018-10-01 19:48:54 +00:00
#### --b2-key
2021-11-01 15:42:05 +00:00
Application Key.
2018-10-01 19:48:54 +00:00
2022-03-18 12:29:54 +00:00
Properties:
2018-10-01 19:48:54 +00:00
- Config: key
- Env Var: RCLONE_B2_KEY
- Type: string
2022-03-18 12:29:54 +00:00
- Required: true
2018-10-01 19:48:54 +00:00
#### --b2-hard-delete
Permanently delete files on remote removal, otherwise hide files.
2022-03-18 12:29:54 +00:00
Properties:
2018-10-01 19:48:54 +00:00
- Config: hard_delete
- Env Var: RCLONE_B2_HARD_DELETE
- Type: bool
- Default: false
2021-11-01 15:42:05 +00:00
### Advanced options
2018-10-01 19:48:54 +00:00
2022-07-09 17:08:20 +00:00
Here are the Advanced options specific to b2 (Backblaze B2).
2018-10-01 19:48:54 +00:00
#### --b2-endpoint
Endpoint for the service.
2021-11-01 15:42:05 +00:00
2018-10-01 19:48:54 +00:00
Leave blank normally.
2022-03-18 12:29:54 +00:00
Properties:
2018-10-01 19:48:54 +00:00
- Config: endpoint
- Env Var: RCLONE_B2_ENDPOINT
- Type: string
2022-03-18 12:29:54 +00:00
- Required: false
2018-10-01 19:48:54 +00:00
#### --b2-test-mode
A flag string for X-Bz-Test-Mode header for debugging.
This is for debugging purposes only. Setting it to one of the strings
below will cause b2 to return specific errors:
* "fail_some_uploads"
* "expire_some_account_authorization_tokens"
* "force_cap_exceeded"
These will be set in the "X-Bz-Test-Mode" header which is documented
2024-05-23 15:23:57 +00:00
in the [b2 integrations checklist ](https://www.backblaze.com/docs/cloud-storage-integration-checklist ).
2018-10-01 19:48:54 +00:00
2022-03-18 12:29:54 +00:00
Properties:
2018-10-01 19:48:54 +00:00
- Config: test_mode
- Env Var: RCLONE_B2_TEST_MODE
- Type: string
2022-03-18 12:29:54 +00:00
- Required: false
2018-10-01 19:48:54 +00:00
#### --b2-versions
Include old versions in directory listings.
2021-11-01 15:42:05 +00:00
2018-10-01 19:48:54 +00:00
Note that when using this no file write operations are permitted,
so you can't upload files or delete them.
2022-03-18 12:29:54 +00:00
Properties:
2018-10-01 19:48:54 +00:00
- Config: versions
- Env Var: RCLONE_B2_VERSIONS
- Type: bool
- Default: false
2022-07-09 17:08:20 +00:00
#### --b2-version-at
Show file versions as they were at the specified time.
Note that when using this no file write operations are permitted,
so you can't upload files or delete them.
Properties:
- Config: version_at
- Env Var: RCLONE_B2_VERSION_AT
- Type: Time
- Default: off
2018-10-01 19:48:54 +00:00
#### --b2-upload-cutoff
Cutoff for switching to chunked upload.
Files above this size will be uploaded in chunks of "--b2-chunk-size".
2021-03-02 19:11:57 +00:00
This value should be set no larger than 4.657 GiB (== 5 GB).
2018-10-01 19:48:54 +00:00
2022-03-18 12:29:54 +00:00
Properties:
2018-10-01 19:48:54 +00:00
- Config: upload_cutoff
- Env Var: RCLONE_B2_UPLOAD_CUTOFF
- Type: SizeSuffix
2021-07-20 18:45:41 +00:00
- Default: 200Mi
2018-10-01 19:48:54 +00:00
2020-09-02 15:59:04 +00:00
#### --b2-copy-cutoff
2021-11-01 15:42:05 +00:00
Cutoff for switching to multipart copy.
2020-09-02 15:59:04 +00:00
2020-10-13 21:43:40 +00:00
Any files larger than this that need to be server-side copied will be
2020-09-02 15:59:04 +00:00
copied in chunks of this size.
2021-03-02 19:11:57 +00:00
The minimum is 0 and the maximum is 4.6 GiB.
2020-09-02 15:59:04 +00:00
2022-03-18 12:29:54 +00:00
Properties:
2020-09-02 15:59:04 +00:00
- Config: copy_cutoff
- Env Var: RCLONE_B2_COPY_CUTOFF
- Type: SizeSuffix
2021-07-20 18:45:41 +00:00
- Default: 4Gi
2020-09-02 15:59:04 +00:00
2018-10-01 19:48:54 +00:00
#### --b2-chunk-size
2021-11-01 15:42:05 +00:00
Upload chunk size.
When uploading large files, chunk the file into this size.
Must fit in memory. These chunks are buffered in memory and there
might a maximum of "--transfers" chunks in progress at once.
2018-10-01 19:48:54 +00:00
2021-11-01 15:42:05 +00:00
5,000,000 Bytes is the minimum size.
2018-10-01 19:48:54 +00:00
2022-03-18 12:29:54 +00:00
Properties:
2018-10-01 19:48:54 +00:00
- Config: chunk_size
- Env Var: RCLONE_B2_CHUNK_SIZE
- Type: SizeSuffix
2021-07-20 18:45:41 +00:00
- Default: 96Mi
2018-10-01 19:48:54 +00:00
2023-09-11 14:59:44 +00:00
#### --b2-upload-concurrency
Concurrency for multipart uploads.
This is the number of chunks of the same file that are uploaded
concurrently.
Note that chunks are stored in memory and there may be up to
"--transfers" * "--b2-upload-concurrency" chunks stored at once
in memory.
Properties:
- Config: upload_concurrency
- Env Var: RCLONE_B2_UPLOAD_CONCURRENCY
- Type: int
2023-11-26 15:59:12 +00:00
- Default: 4
2023-09-11 14:59:44 +00:00
2019-02-09 10:42:57 +00:00
#### --b2-disable-checksum
2021-11-01 15:42:05 +00:00
Disable checksums for large (> upload cutoff) files.
2019-02-09 10:42:57 +00:00
2020-05-22 11:22:52 +00:00
Normally rclone will calculate the SHA1 checksum of the input before
uploading it so it can add it to metadata on the object. This is great
for data integrity checking but can cause long delays for large files
to start uploading.
2022-03-18 12:29:54 +00:00
Properties:
2019-02-09 10:42:57 +00:00
- Config: disable_checksum
- Env Var: RCLONE_B2_DISABLE_CHECKSUM
- Type: bool
- Default: false
2019-04-13 10:01:58 +00:00
#### --b2-download-url
Custom endpoint for downloads.
This is usually set to a Cloudflare CDN URL as Backblaze offers
free egress for data downloaded through the Cloudflare network.
2021-02-02 13:42:35 +00:00
Rclone works with private buckets by sending an "Authorization" header.
If the custom endpoint rewrites the requests for authentication,
e.g., in Cloudflare Workers, this header needs to be handled properly.
2019-04-13 10:01:58 +00:00
Leave blank if you want to use the endpoint provided by Backblaze.
2022-03-18 12:29:54 +00:00
The URL provided here SHOULD have the protocol and SHOULD NOT have
a trailing slash or specify the /file/bucket subpath as rclone will
request files with "{download_url}/file/{bucket_name}/{path}".
Example:
> https://mysubdomain.mydomain.tld
(No trailing "/", "file" or "bucket")
Properties:
2019-04-13 10:01:58 +00:00
- Config: download_url
- Env Var: RCLONE_B2_DOWNLOAD_URL
- Type: string
2022-03-18 12:29:54 +00:00
- Required: false
2019-04-13 10:01:58 +00:00
2019-08-26 14:25:20 +00:00
#### --b2-download-auth-duration
2024-03-10 11:22:43 +00:00
Time before the public link authorization token will expire in s or suffix ms|s|m|h|d.
This is used in combination with "rclone link" for making files
accessible to the public and sets the duration before the download
authorization token will expire.
2019-08-26 14:25:20 +00:00
The minimum value is 1 second. The maximum value is one week.
2022-03-18 12:29:54 +00:00
Properties:
2019-08-26 14:25:20 +00:00
- Config: download_auth_duration
- Env Var: RCLONE_B2_DOWNLOAD_AUTH_DURATION
- Type: Duration
- Default: 1w
2020-09-02 15:59:04 +00:00
#### --b2-memory-pool-flush-time
2023-09-11 14:59:44 +00:00
How often internal memory buffer pools will be flushed. (no longer used)
2020-09-02 15:59:04 +00:00
2022-03-18 12:29:54 +00:00
Properties:
2020-09-02 15:59:04 +00:00
- Config: memory_pool_flush_time
- Env Var: RCLONE_B2_MEMORY_POOL_FLUSH_TIME
- Type: Duration
- Default: 1m0s
#### --b2-memory-pool-use-mmap
2023-09-11 14:59:44 +00:00
Whether to use mmap buffers in internal memory pool. (no longer used)
2020-09-02 15:59:04 +00:00
2022-03-18 12:29:54 +00:00
Properties:
2020-09-02 15:59:04 +00:00
- Config: memory_pool_use_mmap
- Env Var: RCLONE_B2_MEMORY_POOL_USE_MMAP
- Type: bool
- Default: false
2023-11-26 15:59:12 +00:00
#### --b2-lifecycle
Set the number of days deleted files should be kept when creating a bucket.
On bucket creation, this parameter is used to create a lifecycle rule
for the entire bucket.
If lifecycle is 0 (the default) it does not create a lifecycle rule so
the default B2 behaviour applies. This is to create versions of files
on delete and overwrite and to keep them indefinitely.
If lifecycle is >0 then it creates a single rule setting the number of
days before a file that is deleted or overwritten is deleted
permanently. This is known as daysFromHidingToDeleting in the b2 docs.
The minimum value for this parameter is 1 day.
You can also enable hard_delete in the config also which will mean
deletions won't cause versions but overwrites will still cause
versions to be made.
See: [rclone backend lifecycle ](#lifecycle ) for setting lifecycles after bucket creation.
Properties:
- Config: lifecycle
- Env Var: RCLONE_B2_LIFECYCLE
- Type: int
- Default: 0
2020-02-01 10:31:42 +00:00
#### --b2-encoding
2022-03-18 12:29:54 +00:00
The encoding for the backend.
2020-02-01 10:31:42 +00:00
2021-11-01 15:42:05 +00:00
See the [encoding section in the overview ](/overview/#encoding ) for more info.
2020-02-01 10:31:42 +00:00
2022-03-18 12:29:54 +00:00
Properties:
2020-02-01 10:31:42 +00:00
- Config: encoding
- Env Var: RCLONE_B2_ENCODING
2023-11-26 15:59:12 +00:00
- Type: Encoding
2020-02-01 10:31:42 +00:00
- Default: Slash,BackSlash,Del,Ctl,InvalidUtf8,Dot
2024-03-10 11:22:43 +00:00
#### --b2-description
2024-06-14 15:04:51 +00:00
Description of the remote.
2024-03-10 11:22:43 +00:00
Properties:
- Config: description
- Env Var: RCLONE_B2_DESCRIPTION
- Type: string
- Required: false
2023-11-26 15:59:12 +00:00
## Backend commands
Here are the commands specific to the b2 backend.
Run them with
rclone backend COMMAND remote:
The help below will explain what arguments each command takes.
See the [backend ](/commands/rclone_backend/ ) command for more
info on how to pass options and arguments.
These can be run on a running backend using the rc command
[backend/command ](/rc/#backend-command ).
### lifecycle
Read or set the lifecycle for a bucket
rclone backend lifecycle remote: [options] [< arguments > +]
This command can be used to read or set the lifecycle for a bucket.
Usage Examples:
To show the current lifecycle rules:
rclone backend lifecycle b2:bucket
This will dump something like this showing the lifecycle rules.
[
{
"daysFromHidingToDeleting": 1,
"daysFromUploadingToHiding": null,
"fileNamePrefix": ""
}
]
If there are no lifecycle rules (the default) then it will just return [].
To reset the current lifecycle rules:
rclone backend lifecycle b2:bucket -o daysFromHidingToDeleting=30
rclone backend lifecycle b2:bucket -o daysFromUploadingToHiding=5 -o daysFromHidingToDeleting=1
This will run and then print the new lifecycle rules as above.
Rclone only lets you set lifecycles for the whole bucket with the
fileNamePrefix = "".
You can't disable versioning with B2. The best you can do is to set
the daysFromHidingToDeleting to 1 day. You can enable hard_delete in
the config also which will mean deletions won't cause versions but
overwrites will still cause versions to be made.
rclone backend lifecycle b2:bucket -o daysFromHidingToDeleting=1
See: https://www.backblaze.com/docs/cloud-storage-lifecycle-rules
Options:
- "daysFromHidingToDeleting": After a file has been hidden for this many days it is deleted. 0 is off.
- "daysFromUploadingToHiding": This many days after uploading a file is hidden
2024-03-01 00:49:34 +00:00
### cleanup
Remove unfinished large file uploads.
rclone backend cleanup remote: [options] [< arguments > +]
This command removes unfinished large file uploads of age greater than
max-age, which defaults to 24 hours.
Note that you can use --interactive/-i or --dry-run with this command to see what
it would do.
rclone backend cleanup b2:bucket/path/to/object
rclone backend cleanup -o max-age=7w b2:bucket/path/to/object
Durations are parsed as per the rest of rclone, 2h, 7d, 7w etc.
Options:
- "max-age": Max age of upload to delete
### cleanup-hidden
Remove old versions of files.
rclone backend cleanup-hidden remote: [options] [< arguments > +]
This command removes any old hidden versions of files.
Note that you can use --interactive/-i or --dry-run with this command to see what
it would do.
rclone backend cleanup-hidden b2:bucket/path/to/dir
2020-05-22 11:22:52 +00:00
{{< rem autogenerated options stop > }}
2021-10-14 13:40:18 +00:00
## Limitations
2020-11-27 14:08:52 +00:00
`rclone about` is not supported by the B2 backend. Backends without
this capability cannot determine free space for an rclone mount or
use policy `mfs` (most free space) as a member of an rclone union
remote.
2022-05-13 22:06:45 +00:00
See [List of backends that do not support rclone about ](https://rclone.org/overview/#optional-features ) and [rclone about ](https://rclone.org/commands/rclone_about/ )
2020-11-27 14:08:52 +00:00
2018-10-01 17:36:15 +00:00