docs/content/huaweidrive.md
Paths are specified as huaweidrive:path
Huawei Drive paths may be as deep as required, e.g. huaweidrive:directory/subdirectory.
The initial setup for Huawei Drive involves getting a token from Huawei Drive
which you need to do in your browser. rclone config walks you
through it.
Here is an example of how to make a remote called remote. First run:
rclone config
This will guide you through an interactive setup process:
No remotes found, make a new one?
n) New remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
n/r/c/s/q> n
name> remote
Type of storage to configure.
Choose a number from below, or type in your own value
[snip]
XX / Huawei Drive
\ "huaweidrive"
[snip]
Storage> huaweidrive
OAuth Client Id - leave blank to use rclone's default.
client_id>
OAuth Client Secret - leave blank to use rclone's default.
client_secret>
Remote config
Use web browser to automatically authenticate rclone with remote?
* Say Y if the machine running rclone has a web browser you can use
* Say N if running rclone on a (remote) machine without web browser access
If not sure try Y. If Y failed, try N.
y) Yes
n) No
y/n> y
If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth
Log in and authorize rclone for access
Waiting for code...
Got code
Configuration complete.
Options:
- type: huaweidrive
- client_id:
- client_secret:
- token: {"access_token":"XXX","token_type":"Bearer","refresh_token":"XXX","expiry":"2024-03-16T13:57:58.955387075Z"}
Keep this "remote" remote?
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
See the remote setup docs for how to set it up on a machine without an internet-connected web browser available.
Note that rclone runs a webserver on your local machine to collect the
token as returned from Huawei if using web browser to automatically
authenticate. This only runs from the moment it opens your browser to the moment you get back
the verification code. This is on http://127.0.0.1:53682/ and it
may require you to unblock it temporarily if you are running a host
firewall, or use manual mode.
You can then use it like this,
List directories in top level of your drive
rclone lsd remote:
List all the files in your drive
rclone ls remote:
To copy a local directory to a drive directory called backup
rclone copy /home/source remote:backup
When you use rclone with Huawei Drive in its default configuration you are using rclone's client_id. This is shared between all the rclone users. There is a global rate limit on the number of queries per second that each client_id can do set by Huawei.
It is strongly recommended to use your own client ID as the default rclone ID is heavily used. If you have multiple services running, it is recommended to use a separate client ID for each service to avoid rate limiting issues.
Here is how to create your own Huawei Drive client ID for rclone:
Follow the detailed guides for complete setup instructions:
Rclone uses the web application access method to connect to Huawei Drive. Before starting, you need to implement quick login authorization through Huawei Account Open Service. With user authorization credentials, rclone can call Huawei Cloud Drive Service APIs.
Before accessing Drive service, developers need to create a server application first. For details, please refer to the WEB Application Access Development Preparation section in the "Huawei Account Service Development Guide".
Guide users to visit https://cloud.huawei.com/. First-time users need to sign the agreement before they can use Huawei Cloud Drive Service.
Applications accessing Drive should use authentication credential Access Token. For specific acquisition methods, please refer to the WEB Application Access Development Guide section in the "Huawei Account Service Development Guide".
Key steps summary:
Log into the Huawei Developer Console with your Huawei account.
Create a new project or select an existing project.
Go to "Manage APIs" and enable the "Drive Kit" API.
Click on "Credentials" in the left side panel.
Click "Create Credentials" and choose "OAuth client ID".
Choose "Web application" as the application type.
Add http://localhost:53682/ to the "Authorized redirect URIs".
Click "Create" and note down the Client ID and Client Secret.
Provide the noted client ID and client secret to rclone during configuration.
Rclone uses the following OAuth2 scopes when accessing Huawei Drive:
https://www.huawei.com/auth/drive - Full access to Huawei Drive files (excluding application data folder)https://www.huawei.com/auth/drive.file - Access to files created by the applicationopenid - OpenID Connect authenticationprofile - Access to basic profile informationThe drive.file scope is included in the default set used by rclone.
Alternative scopes available (not used by rclone by default):
https://www.huawei.com/auth/drive.appdata - Access to application data folderhttps://www.huawei.com/auth/drive.readonly - Read-only access to file metadata and contenthttps://www.huawei.com/auth/drive.metadata - Read/write access to file metadata onlyhttps://www.huawei.com/auth/drive.metadata.readonly - Read-only access to file metadata onlyThe default scopes provide read/write access to all files in your Huawei Drive.
Huawei Drive does not support setting modification times. The API
always uses server-side timestamps, so file modification times from
the source are not preserved during upload. Modification times are
available as read-only metadata (mtime, btime).
Hash algorithm SHA256 is supported for file integrity verification.
Huawei Drive has strict restrictions on file and directory names:
< > | : " * ? / \ or emoji characters. ..\' in API callsThese restrictions are handled by rclone's encoding:
\ are encodedInvalid characters will be replaced according to the encoding settings.
Huawei Drive supports resumable uploads for files larger than the upload cutoff (default 20MB). Files are uploaded in chunks which allows for recovery from network interruptions.
The maximum file size for Huawei Drive is 50 GiB.
To view your current quota you can use the rclone about remote:
command which will display your usage and quota information.
Here are the Standard options specific to huaweidrive (Huawei Drive).
OAuth Client Id.
Leave blank normally.
Properties:
OAuth Client Secret.
Leave blank normally.
Properties:
Here are the Advanced options specific to huaweidrive (Huawei Drive).
OAuth Access Token as a JSON blob.
Properties:
Auth server URL.
Leave blank to use the provider defaults.
Properties:
Token server url.
Leave blank to use the provider defaults.
Properties:
Use client credentials OAuth flow.
This will use the OAUTH2 client Credentials Flow as described in RFC 6749.
Note that this option is NOT supported by all backends.
Properties:
ID of the root folder.
Normally this is auto-detected, but if it fails or you want to speed up startup, you can set it manually.
Leave blank normally.
Properties:
Upload chunk size.
Must be a power of 2 >= 256k and <= 64MB.
Properties:
Size of listing chunk 1-1000.
Properties:
Cutoff for switching to resumable upload.
Any files larger than this will be uploaded using resumable upload. The minimum is 0 and the maximum is 20 MiB (Huawei Drive API limit for single request uploads).
Properties:
The encoding for the backend.
See the encoding section in the overview for more info.
Properties:
Description of the remote.
Properties:
Huawei Drive supports reading and writing custom metadata.
User metadata can be set using the "properties" field in the API. System metadata includes standard file information such as:
Custom metadata keys can be any string and will be stored in the file's properties.
Here are the possible system metadata items for the huaweidrive backend.
| Name | Help | Type | Example | Read Only |
|---|---|---|---|---|
| btime | Time when the file was created (RFC 3339) | RFC 3339 | Y | |
| content-type | MIME type of the object | string | Y | |
| description | Description of the file | string | N | |
| favorite | Whether the file is marked as favorite (true/false) | string | N | |
| has-thumbnail | Whether the file has a thumbnail (true/false) | string | Y | |
| mtime | Time when the file content was last modified (RFC 3339) | RFC 3339 | Y | |
| recycled | Whether the file is in recycle bin (true/false) | string | Y | |
| sha256 | SHA256 hash of the file | string | Y | |
| utime | Time when the file was last edited by the current user (RFC 3339) | RFC 3339 | Y |
See the metadata docs for more info.
<!-- autogenerated options stop -->Huawei Drive has some rate limiting which may cause rclone to slow down transfers to avoid hitting the limits.
< > | : " * ? / \. ..Huawei Drive imposes API rate limits. Rclone automatically handles these by backing off when limits are hit.
upload_cutoff (default 20MB) are uploaded in a single request using content or multipart method--fast-list for efficient directory traversalCommon errors and their meanings:
401 Unauthorized: Invalid credentials or expired token403 Forbidden: Usually indicates insufficient permissions or API quota exceeded404 Not Found: File or directory does not exist409 Conflict: Directory already exists429 Too Many Requests: API rate limit exceeded, rclone will automatically retryFor better performance:
--transfers for concurrent operations (default is 4)chunk_size based on your network speed and file sizes--fast-list for operations on directories with many files to reduce API callsHuawei Drive is suitable for backups with some considerations:
rclone sync rather than rclone copy to maintain exact directory structure--backup-dir to preserve deleted files--checksum flag for critical dataHuawei Drive supports the following rclone features:
Copy - Server-side copy of filesMove - Server-side move/rename of filesDirMove - Server-side move of directoriesListR - Recursive listing for --fast-listAbout - Storage quota informationPurge - Delete directory and all contentsCleanUp - Empty the trashUserInfo - Get user account informationMetadata - Read and write file metadata/propertiesChangeNotify - Poll for remote changes (used by rclone mount and rclone rc vfs/poll-interval)Huawei Drive can be used as a backend for various rclone operations:
rclone mountrclone serve httprclone serve ftprclone serve webdavNote that some operations may be slower than local storage due to API limitations and network latency.