Updated on 2023-03-16 GMT+08:00

Restoring Objects from

Function

You can use this command to restore a specified object whose storage class is cold or restore objects in batches by object name prefix.

  • Object content cannot be read during restoration.
  • After an object is restored, the time it requires before the object can be downloaded depends on the OBS server.

To prolong the validity period of the Archive data restored, you can repeatedly restore the Archive data, but you will be billed for each restore. After a second restore, the validity period of Standard object copies will be prolonged, and you need to pay for storing these copies during the prolonged period.

Command Line Structure

  • In Windows
    • Restoring an object
      obsutil restore obs://bucket/key [-d=1] [-t=xxx] [-versionId=xxx] [-fr] [-o=xxx] [-config=xxx] 
    • Restoring objects in batches
      obsutil restore obs://bucket[/key] -r [-f] [-v] [-d=1] [-t=xxx] [-o=xxx] [-j=1] [-config=xxx] 
    • Restoring all objects in a specific directory at a time
      obsutil restore obs://bucket/folder/ -r [-f] [-v] [-d=1] [-t=xxx] [-o=xxx] [-j=1] [-config=xxx] 
  • In Linux or macOS
    • Restoring an object
      ./obsutil restore obs://bucket/key [-d=1] [-t=xxx] [-versionId=xxx] [-fr] [-o=xxx] [-config=xxx] 
    • Restoring objects in batches
      ./obsutil restore obs://bucket[/key] -r [-f] [-v] [-d=1] [-t=xxx] [-o=xxx] [-j=1] [-config=xxx] 
    • Restoring all objects in a specific directory at a time
      ./obsutil restore obs://bucket/folder/ -r [-f] [-v] [-d=1] [-t=xxx] [-o=xxx] [-j=1] [-config=xxx] 

Examples

  • Take the Windows OS as an example. Run the obsutil restore obs://bucket-test/key command to restore a single object whose storage class is cold.
    obsutil restore obs://bucket-test/key
    
    Start to restore object [key] in the bucket [bucket-test] successfully!
  • Take the Windows OS as an example. Run the obsutil restore obs://bucket-test -r -f command to restore objects whose storage class is cold in the bucket in batches.
    obsutil restore obs://bucket-test -r -f
    
    [================================================] 100.00% 3s
    Succeed count is:   12        Failed count is:    0
    Metrics [max cost:264 ms, min cost:54 ms, average cost:119.33 ms, average tps:19.70]
    Task id is: 96f104ee-d0bf-40ff-95dd-31dec0d8f4f4

Parameter Description

Parameter

Optional or Mandatory

Description

bucket

Mandatory

Bucket name

key

Mandatory for restoring a single object whose storage class is cold

Optional for batch restoring objects whose storage class is cold

Indicates the name of the object to be restored or the name prefix of the objects to be restored in batches.

NOTE:

If this parameter is left blank when batch restoring objects, all objects whose storage class is cold in the bucket are restored.

d

Optional (additional parameter)

Storage duration after objects whose storage class is cold are restored, in days. The value ranges from 1 to 30. The default value is 1.

t

Optional (additional parameter)

Options for restoring objects. Possible values are:

  • standard
  • expedited
NOTE:
  • A standard restore of objects takes 3 to 5 hours, while an expedited restore of objects takes 1 to 5 minutes.
  • If this parameter is not configured, an expedited restore is used by default.

versionId

Optional for restoring a single object whose storage class is cold (additional parameter)

Version ID of the to-be-restored object whose storage class is cold

fr

Optional for restoring a single object whose storage class is cold (additional parameter)

Generates an operation result list when restoring a single object whose storage class is cold.

f

Optional for batch restoring objects whose storage class is cold (additional parameter)

Runs in force mode.

r

Mandatory for batch restoring objects whose storage class is cold (additional parameter)

Restores objects whose storage class is cold in batches by object name prefix.

v

Optional for batch restoring objects whose storage class is cold (additional parameter)

Restores versions of objects whose storage class is cold in batches by object name prefix.

o

Optional (additional parameter)

Indicates the folder where operation result lists reside. After the command is executed, result lists (possibly including success and failure files) are generated in the folder. The default value is .obsutil_output, the subfolder in the home directory of the user who executes obsutil commands.

NOTE:
  • The naming rule for result lists is as follows: restore_{succeed | failed}_report_time_TaskId.txt

    By default, the maximum size of a single result list is 30 MB and the maximum number of result lists that can be retained is 1024. You can set the maximum size and number by configuring recordMaxLogSize and recordBackups in the configuration file.

j

Optional for batch restoring objects whose storage class is cold (additional parameter)

Maximum number of concurrent tasks for batch restoring objects whose storage class is cold. The default value is the value of defaultJobs in the configuration file.

NOTE:

The value is ensured to be greater than or equal to 1.

config

Optional (additional parameter)

User-defined configuration file for executing a command. For details about parameters that can be configured, see Parameter Description.

Response

Refer to Response for uploading an object.