mc version enable

mc version enable

Syntax

The mc version enable command enables versioning on the specified bucket.

Parameters

ALIAS

Required

The alias of an AIStor Object Store and the full path to the bucket for which to enableversioning. For example:

mc version enable myminio/mybucket

--exclude-folders

Optional

Disable versioning on all folders (objects whose name ends with /) in the specified bucket.

--excluded-prefixes

Optional

Disable versioning on objects matching a list of prefixes, up to 10. The list of prefixes match all objects containing the specified strings in their prefix or name, similar to a regular expression of the form prefix*. To match objects by prefix only, use prefix/*.

Specify multiple prefixes as a comma-separated list.

For example, the following command excludes any objects containing _test or _temp in their prefix or name from versioning:

mc version enable myminio/mybucket --excluded-prefixes "_test,_temp"

--purge-on-delete

Optional

When marking the current version of an object for deletion, purge the current and all non-current versions. Valid values are on or off.

If not specified, the value defaults to off.

This is particularly useful for buckets used with Spark and Hadoop workloads.

Global Flags

This command supports any of the global flags.

Example

Enable Bucket Versioning

Use mc version enable to enable versioning for a bucket:

mc version enable ALIAS/PATH
  • Replace ALIAS with the alias of a configured AIStor deployment.
  • Replace PATH with the bucket on which to enable versioning.

Enable bucket versioning except for specified prefixes, purge all versions on delete

Enable versioning on a bucket for all objects that do not begin with the specified prefixes. When deleting an object, remove the current and all non-current versions.

mc version enable myminio/mybucket --excluded-prefixes "app1/*/_temporary/,app2/*/_staging/" --purge-on-delete "on"

Behavior

Bucket Versioning with Existing Data

Enabling bucket versioning on a bucket with existing data immediately creates a NULL value version ID for each unversioned object.

S3 Compatibility

The mc commandline tool is built for compatibility with the AWS S3 API and is tested with AIStor and AWS S3 for expected functionality and behavior.

AIStor provides no guarantees for other S3-compatible services, As their S3 API implementation is unknown and therefore unsupported.

While mc commands may work as documented, any such usage is at your own risk.