Welcome to the upcoming version of the MinIO Documentation! The content on this page is under active development and may change at any time. If you can't find what you're looking for, check our legacy documentation. Thank you for your patience.

mc legalhold

Description

The mc legalhold command enables or disables object legal hold. Enabling legal hold on an object prevents any modification or deletion of the object and is equivalent to setting Write-Once Read-Only (WORM) mode on the object.

Important

mc legalhold requires that the specified bucket has object locking enabled. You can only enable object locking at bucket creation.

See mc mb --with-lock for documentation on creating buckets with object locking enabled.

Examples

Syntax

mc legalhold set

Enables legal hold on an object or object(s).

The command has the following syntax:

mc legalhold set [FLAGS] TARGET

The command accepts the following arguments:

TARGET

Required

The full path to the object or bucket on which to enable the legal hold. Specify the alias of a configured S3-compatible service as the prefix to the TARGET path. For example:

mc legalhold set play/mybucket/myobject.txt

If you specify a path to a bucket or bucket prefix, you must also specify mc legalhold set --recursive.

--recursive, --r

Applies the legal hold to all objects in the TARGET bucket or bucket prefix.

--rewind

Directs mc legalhold set to operate only on the object version(s) that existed at specified point-in-time.

  • To rewind to a specific date in the past, specify the date as an ISO8601-formatted timestamp. For example: --rewind "2020.03.24T10:00".

  • To rewind a duration in time, specify the duration as a string in #d#hh#mm#ss format. For example: --rewind "1d2hh3mm4ss".

--rewind requires that the specified --TARGET be an S3-compatible service that supports Bucket Versioning. For MinIO deployments, use mc version to enable or disable bucket versioning.

--version-id, --vid

Directs mc legalhold set to operate only on the specified object version.

--version-id requires that the specified --TARGET be an S3-compatible service that supports Bucket Versioning. For MinIO deployments, use mc version to enable or disable bucket versioning.

clear

Removes legal hold on an object or object(s).

The command has the following syntax:

mc legalhold clear [FLAGS] TARGET

The command accepts the following arguments:

TARGET

Required The full path to the object or bucket on which to remove the legal hold. Specify the alias of a configured S3-compatible service as the prefix to the TARGET path. For example:

mc legalhold set play/mybucket/myobject.txt

If you specify a path to a bucket or bucket prefix, you must also specify mc legalhold set --recursive.

--recursive, --r

Removes the legal hold from all objects in the TARGET bucket or bucket prefix.

--rewind

Directs mc legalhold clear to operate only on the object version(s) that existed at specified point-in-time.

  • To rewind to a specific date in the past, specify the date as an ISO8601-formatted timestamp. For example: --rewind "2020.03.24T10:00".

  • To rewind a duration in time, specify the duration as a string in #d#hh#mm#ss format. For example: --rewind "1d2hh3mm4ss".

--rewind requires that the specified --TARGET be an S3-compatible service that supports Bucket Versioning. For MinIO deployments, use mc version to enable or disable bucket versioning.

--version-id, --vid

Directs mc legalhold clear to operate only on the specified object version.

--version-id requires that the specified --TARGET be an S3-compatible service that supports Bucket Versioning. For MinIO deployments, use mc version to enable or disable bucket versioning.

info

Retrieves the legal hold status of an object or object(s).

The command has the following syntax:

mc legalhold info [FLAGS] TARGET

The command accepts the following arguments:

TARGET

Required The full path to the object or bucket on which to retrieve the legal hold status. Specify the alias of a configured S3-compatible service as the prefix to the TARGET path. For example:

mc legalhold set play/mybucket/myobject.txt

If you specify a path to a bucket or bucket prefix, you must also specify mc legalhold set --recursive.

--recursive, --r

Retrieves the legal hold from all objects in the TARGET bucket or bucket prefix.

--rewind

Directs mc legalhold info to operate only on the object version(s) that existed at specified point-in-time.

  • To rewind to a specific date in the past, specify the date as an ISO8601-formatted timestamp. For example: --rewind "2020.03.24T10:00".

  • To rewind a duration in time, specify the duration as a string in #d#hh#mm#ss format. For example: --rewind "1d2hh3mm4ss".

--rewind requires that the specified --TARGET be an S3-compatible service that supports Bucket Versioning. For MinIO deployments, use mc version to enable or disable bucket versioning.

--version-id, --vid

Directs mc legalhold info to operate only on the specified object version.

--version-id requires that the specified --TARGET be an S3-compatible service that supports Bucket Versioning. For MinIO deployments, use mc version to enable or disable bucket versioning.