github.com/artpar/rclone@v1.67.3/docs/content/swift.md (about) 1 --- 2 title: "Swift" 3 description: "Swift" 4 versionIntroduced: "v0.91" 5 --- 6 7 # {{< icon "fa fa-space-shuttle" >}} Swift 8 9 Swift refers to [OpenStack Object Storage](https://docs.openstack.org/swift/latest/). 10 Commercial implementations of that being: 11 12 * [Rackspace Cloud Files](https://www.rackspace.com/cloud/files/) 13 * [Memset Memstore](https://www.memset.com/cloud/storage/) 14 * [OVH Object Storage](https://www.ovh.co.uk/public-cloud/storage/object-storage/) 15 * [Oracle Cloud Storage](https://docs.oracle.com/en-us/iaas/integration/doc/configure-object-storage.html) 16 * [Blomp Cloud Storage](https://www.blomp.com/cloud-storage/) 17 * [IBM Bluemix Cloud ObjectStorage Swift](https://console.bluemix.net/docs/infrastructure/objectstorage-swift/index.html) 18 19 Paths are specified as `remote:container` (or `remote:` for the `lsd` 20 command.) You may put subdirectories in too, e.g. `remote:container/path/to/dir`. 21 22 ## Configuration 23 24 Here is an example of making a swift configuration. First run 25 26 rclone config 27 28 This will guide you through an interactive setup process. 29 30 ``` 31 No remotes found, make a new one? 32 n) New remote 33 s) Set configuration password 34 q) Quit config 35 n/s/q> n 36 name> remote 37 Type of storage to configure. 38 Choose a number from below, or type in your own value 39 [snip] 40 XX / OpenStack Swift (Rackspace Cloud Files, Blomp Cloud Storage, Memset Memstore, OVH) 41 \ "swift" 42 [snip] 43 Storage> swift 44 Get swift credentials from environment variables in standard OpenStack form. 45 Choose a number from below, or type in your own value 46 1 / Enter swift credentials in the next step 47 \ "false" 48 2 / Get swift credentials from environment vars. Leave other fields blank if using this. 49 \ "true" 50 env_auth> true 51 User name to log in (OS_USERNAME). 52 user> 53 API key or password (OS_PASSWORD). 54 key> 55 Authentication URL for server (OS_AUTH_URL). 56 Choose a number from below, or type in your own value 57 1 / Rackspace US 58 \ "https://auth.api.rackspacecloud.com/v1.0" 59 2 / Rackspace UK 60 \ "https://lon.auth.api.rackspacecloud.com/v1.0" 61 3 / Rackspace v2 62 \ "https://identity.api.rackspacecloud.com/v2.0" 63 4 / Memset Memstore UK 64 \ "https://auth.storage.memset.com/v1.0" 65 5 / Memset Memstore UK v2 66 \ "https://auth.storage.memset.com/v2.0" 67 6 / OVH 68 \ "https://auth.cloud.ovh.net/v3" 69 7 / Blomp Cloud Storage 70 \ "https://authenticate.ain.net" 71 auth> 72 User ID to log in - optional - most swift systems use user and leave this blank (v3 auth) (OS_USER_ID). 73 user_id> 74 User domain - optional (v3 auth) (OS_USER_DOMAIN_NAME) 75 domain> 76 Tenant name - optional for v1 auth, this or tenant_id required otherwise (OS_TENANT_NAME or OS_PROJECT_NAME) 77 tenant> 78 Tenant ID - optional for v1 auth, this or tenant required otherwise (OS_TENANT_ID) 79 tenant_id> 80 Tenant domain - optional (v3 auth) (OS_PROJECT_DOMAIN_NAME) 81 tenant_domain> 82 Region name - optional (OS_REGION_NAME) 83 region> 84 Storage URL - optional (OS_STORAGE_URL) 85 storage_url> 86 Auth Token from alternate authentication - optional (OS_AUTH_TOKEN) 87 auth_token> 88 AuthVersion - optional - set to (1,2,3) if your auth URL has no version (ST_AUTH_VERSION) 89 auth_version> 90 Endpoint type to choose from the service catalogue (OS_ENDPOINT_TYPE) 91 Choose a number from below, or type in your own value 92 1 / Public (default, choose this if not sure) 93 \ "public" 94 2 / Internal (use internal service net) 95 \ "internal" 96 3 / Admin 97 \ "admin" 98 endpoint_type> 99 Remote config 100 -------------------- 101 [test] 102 env_auth = true 103 user = 104 key = 105 auth = 106 user_id = 107 domain = 108 tenant = 109 tenant_id = 110 tenant_domain = 111 region = 112 storage_url = 113 auth_token = 114 auth_version = 115 endpoint_type = 116 -------------------- 117 y) Yes this is OK 118 e) Edit this remote 119 d) Delete this remote 120 y/e/d> y 121 ``` 122 123 This remote is called `remote` and can now be used like this 124 125 See all containers 126 127 rclone lsd remote: 128 129 Make a new container 130 131 rclone mkdir remote:container 132 133 List the contents of a container 134 135 rclone ls remote:container 136 137 Sync `/home/local/directory` to the remote container, deleting any 138 excess files in the container. 139 140 rclone sync --interactive /home/local/directory remote:container 141 142 ### Configuration from an OpenStack credentials file 143 144 An OpenStack credentials file typically looks something something 145 like this (without the comments) 146 147 ``` 148 export OS_AUTH_URL=https://a.provider.net/v2.0 149 export OS_TENANT_ID=ffffffffffffffffffffffffffffffff 150 export OS_TENANT_NAME="1234567890123456" 151 export OS_USERNAME="123abc567xy" 152 echo "Please enter your OpenStack Password: " 153 read -sr OS_PASSWORD_INPUT 154 export OS_PASSWORD=$OS_PASSWORD_INPUT 155 export OS_REGION_NAME="SBG1" 156 if [ -z "$OS_REGION_NAME" ]; then unset OS_REGION_NAME; fi 157 ``` 158 159 The config file needs to look something like this where `$OS_USERNAME` 160 represents the value of the `OS_USERNAME` variable - `123abc567xy` in 161 the example above. 162 163 ``` 164 [remote] 165 type = swift 166 user = $OS_USERNAME 167 key = $OS_PASSWORD 168 auth = $OS_AUTH_URL 169 tenant = $OS_TENANT_NAME 170 ``` 171 172 Note that you may (or may not) need to set `region` too - try without first. 173 174 ### Configuration from the environment 175 176 If you prefer you can configure rclone to use swift using a standard 177 set of OpenStack environment variables. 178 179 When you run through the config, make sure you choose `true` for 180 `env_auth` and leave everything else blank. 181 182 rclone will then set any empty config parameters from the environment 183 using standard OpenStack environment variables. There is [a list of 184 the 185 variables](https://godoc.org/github.com/ncw/swift#Connection.ApplyEnvironment) 186 in the docs for the swift library. 187 188 ### Using an alternate authentication method 189 190 If your OpenStack installation uses a non-standard authentication method 191 that might not be yet supported by rclone or the underlying swift library, 192 you can authenticate externally (e.g. calling manually the `openstack` 193 commands to get a token). Then, you just need to pass the two 194 configuration variables ``auth_token`` and ``storage_url``. 195 If they are both provided, the other variables are ignored. rclone will 196 not try to authenticate but instead assume it is already authenticated 197 and use these two variables to access the OpenStack installation. 198 199 #### Using rclone without a config file 200 201 You can use rclone with swift without a config file, if desired, like 202 this: 203 204 ``` 205 source openstack-credentials-file 206 export RCLONE_CONFIG_MYREMOTE_TYPE=swift 207 export RCLONE_CONFIG_MYREMOTE_ENV_AUTH=true 208 rclone lsd myremote: 209 ``` 210 211 ### --fast-list 212 213 This remote supports `--fast-list` which allows you to use fewer 214 transactions in exchange for more memory. See the [rclone 215 docs](/docs/#fast-list) for more details. 216 217 ### --update and --use-server-modtime 218 219 As noted below, the modified time is stored on metadata on the object. It is 220 used by default for all operations that require checking the time a file was 221 last updated. It allows rclone to treat the remote more like a true filesystem, 222 but it is inefficient because it requires an extra API call to retrieve the 223 metadata. 224 225 For many operations, the time the object was last uploaded to the remote is 226 sufficient to determine if it is "dirty". By using `--update` along with 227 `--use-server-modtime`, you can avoid the extra API call and simply upload 228 files whose local modtime is newer than the time it was last uploaded. 229 230 ### Modification times and hashes 231 232 The modified time is stored as metadata on the object as 233 `X-Object-Meta-Mtime` as floating point since the epoch accurate to 1 234 ns. 235 236 This is a de facto standard (used in the official python-swiftclient 237 amongst others) for storing the modification time for an object. 238 239 The MD5 hash algorithm is supported. 240 241 ### Restricted filename characters 242 243 | Character | Value | Replacement | 244 | --------- |:-----:|:-----------:| 245 | NUL | 0x00 | ␀ | 246 | / | 0x2F | / | 247 248 Invalid UTF-8 bytes will also be [replaced](/overview/#invalid-utf8), 249 as they can't be used in JSON strings. 250 251 {{< rem autogenerated options start" - DO NOT EDIT - instead edit fs.RegInfo in backend/swift/swift.go then run make backenddocs" >}} 252 ### Standard options 253 254 Here are the Standard options specific to swift (OpenStack Swift (Rackspace Cloud Files, Blomp Cloud Storage, Memset Memstore, OVH)). 255 256 #### --swift-env-auth 257 258 Get swift credentials from environment variables in standard OpenStack form. 259 260 Properties: 261 262 - Config: env_auth 263 - Env Var: RCLONE_SWIFT_ENV_AUTH 264 - Type: bool 265 - Default: false 266 - Examples: 267 - "false" 268 - Enter swift credentials in the next step. 269 - "true" 270 - Get swift credentials from environment vars. 271 - Leave other fields blank if using this. 272 273 #### --swift-user 274 275 User name to log in (OS_USERNAME). 276 277 Properties: 278 279 - Config: user 280 - Env Var: RCLONE_SWIFT_USER 281 - Type: string 282 - Required: false 283 284 #### --swift-key 285 286 API key or password (OS_PASSWORD). 287 288 Properties: 289 290 - Config: key 291 - Env Var: RCLONE_SWIFT_KEY 292 - Type: string 293 - Required: false 294 295 #### --swift-auth 296 297 Authentication URL for server (OS_AUTH_URL). 298 299 Properties: 300 301 - Config: auth 302 - Env Var: RCLONE_SWIFT_AUTH 303 - Type: string 304 - Required: false 305 - Examples: 306 - "https://auth.api.rackspacecloud.com/v1.0" 307 - Rackspace US 308 - "https://lon.auth.api.rackspacecloud.com/v1.0" 309 - Rackspace UK 310 - "https://identity.api.rackspacecloud.com/v2.0" 311 - Rackspace v2 312 - "https://auth.storage.memset.com/v1.0" 313 - Memset Memstore UK 314 - "https://auth.storage.memset.com/v2.0" 315 - Memset Memstore UK v2 316 - "https://auth.cloud.ovh.net/v3" 317 - OVH 318 - "https://authenticate.ain.net" 319 - Blomp Cloud Storage 320 321 #### --swift-user-id 322 323 User ID to log in - optional - most swift systems use user and leave this blank (v3 auth) (OS_USER_ID). 324 325 Properties: 326 327 - Config: user_id 328 - Env Var: RCLONE_SWIFT_USER_ID 329 - Type: string 330 - Required: false 331 332 #### --swift-domain 333 334 User domain - optional (v3 auth) (OS_USER_DOMAIN_NAME) 335 336 Properties: 337 338 - Config: domain 339 - Env Var: RCLONE_SWIFT_DOMAIN 340 - Type: string 341 - Required: false 342 343 #### --swift-tenant 344 345 Tenant name - optional for v1 auth, this or tenant_id required otherwise (OS_TENANT_NAME or OS_PROJECT_NAME). 346 347 Properties: 348 349 - Config: tenant 350 - Env Var: RCLONE_SWIFT_TENANT 351 - Type: string 352 - Required: false 353 354 #### --swift-tenant-id 355 356 Tenant ID - optional for v1 auth, this or tenant required otherwise (OS_TENANT_ID). 357 358 Properties: 359 360 - Config: tenant_id 361 - Env Var: RCLONE_SWIFT_TENANT_ID 362 - Type: string 363 - Required: false 364 365 #### --swift-tenant-domain 366 367 Tenant domain - optional (v3 auth) (OS_PROJECT_DOMAIN_NAME). 368 369 Properties: 370 371 - Config: tenant_domain 372 - Env Var: RCLONE_SWIFT_TENANT_DOMAIN 373 - Type: string 374 - Required: false 375 376 #### --swift-region 377 378 Region name - optional (OS_REGION_NAME). 379 380 Properties: 381 382 - Config: region 383 - Env Var: RCLONE_SWIFT_REGION 384 - Type: string 385 - Required: false 386 387 #### --swift-storage-url 388 389 Storage URL - optional (OS_STORAGE_URL). 390 391 Properties: 392 393 - Config: storage_url 394 - Env Var: RCLONE_SWIFT_STORAGE_URL 395 - Type: string 396 - Required: false 397 398 #### --swift-auth-token 399 400 Auth Token from alternate authentication - optional (OS_AUTH_TOKEN). 401 402 Properties: 403 404 - Config: auth_token 405 - Env Var: RCLONE_SWIFT_AUTH_TOKEN 406 - Type: string 407 - Required: false 408 409 #### --swift-application-credential-id 410 411 Application Credential ID (OS_APPLICATION_CREDENTIAL_ID). 412 413 Properties: 414 415 - Config: application_credential_id 416 - Env Var: RCLONE_SWIFT_APPLICATION_CREDENTIAL_ID 417 - Type: string 418 - Required: false 419 420 #### --swift-application-credential-name 421 422 Application Credential Name (OS_APPLICATION_CREDENTIAL_NAME). 423 424 Properties: 425 426 - Config: application_credential_name 427 - Env Var: RCLONE_SWIFT_APPLICATION_CREDENTIAL_NAME 428 - Type: string 429 - Required: false 430 431 #### --swift-application-credential-secret 432 433 Application Credential Secret (OS_APPLICATION_CREDENTIAL_SECRET). 434 435 Properties: 436 437 - Config: application_credential_secret 438 - Env Var: RCLONE_SWIFT_APPLICATION_CREDENTIAL_SECRET 439 - Type: string 440 - Required: false 441 442 #### --swift-auth-version 443 444 AuthVersion - optional - set to (1,2,3) if your auth URL has no version (ST_AUTH_VERSION). 445 446 Properties: 447 448 - Config: auth_version 449 - Env Var: RCLONE_SWIFT_AUTH_VERSION 450 - Type: int 451 - Default: 0 452 453 #### --swift-endpoint-type 454 455 Endpoint type to choose from the service catalogue (OS_ENDPOINT_TYPE). 456 457 Properties: 458 459 - Config: endpoint_type 460 - Env Var: RCLONE_SWIFT_ENDPOINT_TYPE 461 - Type: string 462 - Default: "public" 463 - Examples: 464 - "public" 465 - Public (default, choose this if not sure) 466 - "internal" 467 - Internal (use internal service net) 468 - "admin" 469 - Admin 470 471 #### --swift-storage-policy 472 473 The storage policy to use when creating a new container. 474 475 This applies the specified storage policy when creating a new 476 container. The policy cannot be changed afterwards. The allowed 477 configuration values and their meaning depend on your Swift storage 478 provider. 479 480 Properties: 481 482 - Config: storage_policy 483 - Env Var: RCLONE_SWIFT_STORAGE_POLICY 484 - Type: string 485 - Required: false 486 - Examples: 487 - "" 488 - Default 489 - "pcs" 490 - OVH Public Cloud Storage 491 - "pca" 492 - OVH Public Cloud Archive 493 494 ### Advanced options 495 496 Here are the Advanced options specific to swift (OpenStack Swift (Rackspace Cloud Files, Blomp Cloud Storage, Memset Memstore, OVH)). 497 498 #### --swift-leave-parts-on-error 499 500 If true avoid calling abort upload on a failure. 501 502 It should be set to true for resuming uploads across different sessions. 503 504 Properties: 505 506 - Config: leave_parts_on_error 507 - Env Var: RCLONE_SWIFT_LEAVE_PARTS_ON_ERROR 508 - Type: bool 509 - Default: false 510 511 #### --swift-chunk-size 512 513 Above this size files will be chunked into a _segments container. 514 515 Above this size files will be chunked into a _segments container. The 516 default for this is 5 GiB which is its maximum value. 517 518 Properties: 519 520 - Config: chunk_size 521 - Env Var: RCLONE_SWIFT_CHUNK_SIZE 522 - Type: SizeSuffix 523 - Default: 5Gi 524 525 #### --swift-no-chunk 526 527 Don't chunk files during streaming upload. 528 529 When doing streaming uploads (e.g. using rcat or mount) setting this 530 flag will cause the swift backend to not upload chunked files. 531 532 This will limit the maximum upload size to 5 GiB. However non chunked 533 files are easier to deal with and have an MD5SUM. 534 535 Rclone will still chunk files bigger than chunk_size when doing normal 536 copy operations. 537 538 Properties: 539 540 - Config: no_chunk 541 - Env Var: RCLONE_SWIFT_NO_CHUNK 542 - Type: bool 543 - Default: false 544 545 #### --swift-no-large-objects 546 547 Disable support for static and dynamic large objects 548 549 Swift cannot transparently store files bigger than 5 GiB. There are 550 two schemes for doing that, static or dynamic large objects, and the 551 API does not allow rclone to determine whether a file is a static or 552 dynamic large object without doing a HEAD on the object. Since these 553 need to be treated differently, this means rclone has to issue HEAD 554 requests for objects for example when reading checksums. 555 556 When `no_large_objects` is set, rclone will assume that there are no 557 static or dynamic large objects stored. This means it can stop doing 558 the extra HEAD calls which in turn increases performance greatly 559 especially when doing a swift to swift transfer with `--checksum` set. 560 561 Setting this option implies `no_chunk` and also that no files will be 562 uploaded in chunks, so files bigger than 5 GiB will just fail on 563 upload. 564 565 If you set this option and there *are* static or dynamic large objects, 566 then this will give incorrect hashes for them. Downloads will succeed, 567 but other operations such as Remove and Copy will fail. 568 569 570 Properties: 571 572 - Config: no_large_objects 573 - Env Var: RCLONE_SWIFT_NO_LARGE_OBJECTS 574 - Type: bool 575 - Default: false 576 577 #### --swift-encoding 578 579 The encoding for the backend. 580 581 See the [encoding section in the overview](/overview/#encoding) for more info. 582 583 Properties: 584 585 - Config: encoding 586 - Env Var: RCLONE_SWIFT_ENCODING 587 - Type: Encoding 588 - Default: Slash,InvalidUtf8 589 590 #### --swift-description 591 592 Description of the remote 593 594 Properties: 595 596 - Config: description 597 - Env Var: RCLONE_SWIFT_DESCRIPTION 598 - Type: string 599 - Required: false 600 601 {{< rem autogenerated options stop >}} 602 603 ## Limitations 604 605 The Swift API doesn't return a correct MD5SUM for segmented files 606 (Dynamic or Static Large Objects) so rclone won't check or use the 607 MD5SUM for these. 608 609 ## Troubleshooting 610 611 ### Rclone gives Failed to create file system for "remote:": Bad Request 612 613 Due to an oddity of the underlying swift library, it gives a "Bad 614 Request" error rather than a more sensible error when the 615 authentication fails for Swift. 616 617 So this most likely means your username / password is wrong. You can 618 investigate further with the `--dump-bodies` flag. 619 620 This may also be caused by specifying the region when you shouldn't 621 have (e.g. OVH). 622 623 ### Rclone gives Failed to create file system: Response didn't have storage url and auth token 624 625 This is most likely caused by forgetting to specify your tenant when 626 setting up a swift remote. 627 628 ## OVH Cloud Archive 629 630 To use rclone with OVH cloud archive, first use `rclone config` to set up a `swift` backend with OVH, choosing `pca` as the `storage_policy`. 631 632 ### Uploading Objects 633 634 Uploading objects to OVH cloud archive is no different to object storage, you just simply run the command you like (move, copy or sync) to upload the objects. Once uploaded the objects will show in a "Frozen" state within the OVH control panel. 635 636 ### Retrieving Objects 637 638 To retrieve objects use `rclone copy` as normal. If the objects are in a frozen state then rclone will ask for them all to be unfrozen and it will wait at the end of the output with a message like the following: 639 640 `2019/03/23 13:06:33 NOTICE: Received retry after error - sleeping until 2019-03-23T13:16:33.481657164+01:00 (9m59.99985121s)` 641 642 Rclone will wait for the time specified then retry the copy.