Object Storage Service (OSS) allows you to configure versioning to protect data at the bucket level. After you enable versioning for a bucket, data that is overwritten or deleted in the bucket is saved as a previous version. You can use versioning to restore a previous version of an object that is accidentally overwritten or deleted.
Background information
Enable versioning
When versioning is enabled for a bucket, OSS specifies a unique ID for each version of an object stored in the bucket.
- Enable versioning when you create a bucket
- Log on to the OSS console.
- In the left-side navigation pane, click Buckets. On the Buckets page, click Create Bucket.
- In the Create Bucket panel, configure the parameters.
Set Versioning to Activate. For more information about how to configure other parameters, see Create buckets.
- Click OK.
- Enable versioning for an existing bucket
- In the left-side navigation pane, click Buckets. On the Buckets page, click the name of the bucket for which you want to enable versioning.
- In the left-side navigation pane, choose .
- Click Configure. Set Versioning to Enabled.
- Click Save.
After versioning is enabled for a bucket, you can view all versions of objects in the bucket on the Files page. If you want to view only the current versions of objects, set Display Previous Versions to Hide. Hiding previous versions of objects does not increase the response speed when you list objects. If the response speed is slow when you list objects, see Low response speed to troubleshoot and fix the problem.
Restore a previous version
To restore a specified previous version of an object as the current version, perform the following steps:
Download a specified version of an object
To download a specified version of an object, perform the following steps:
- In the left-side navigation pane, click Files.
- Click the version that you want to download. In the panel that appears, click Download on the right side of Object URL.
- Select the location where you want to store the downloaded version and then click Save.
Delete a previous version of an object
To minimize storage costs, we recommend that you delete the previous versions of objects that you no longer need at your earliest opportunity.
- You cannot restore a previous version of an object after it is deleted. Proceed with caution.
-
We recommend that you do not enable the OSS-HDFS service and versioning for a bucket at the same time.
If you enable versioning for a bucket with the OSS-HDFS service enabled, data that is overwritten or deleted is saved as previous versions. When you overwrite or delete data in the
.dlsdata/
directory by using the methods that are supported by the OSS-HDFS service, a message that indicates that the data is successfully overwritten or deleted is displayed. OSS retains the data that is overwritten or deleted as previous versions because versioning is enabled for the bucket.In this case, you can specify version IDs to delete previous versions of objects from the
.dlsdata/
directory.
You can also configure lifecycle rules to allow OSS to periodically delete previous versions. For more information, see Configure lifecycle rules.
Suspend versioning
You can suspend versioning for a versioned bucket to stop OSS from generating new versions for objects. If a new version is generated for an object in a versioning-suspended bucket, OSS sets the ID of the new version to null and retains the previous versions of the object.
To suspend versioning for a bucket, perform the following steps:
- In the left-side navigation pane, click Buckets. On the Buckets page, click the name of the bucket for which you want to suspend versioning.
- In the left-side navigation pane, choose .
- Click Configure and set the versioning state to Suspended.
- Click Save.