1
0
mirror of https://github.com/minio/docs.git synced 2025-07-30 07:03:26 +03:00
Files
docs/source/reference/minio-mc/mc-mb.rst
2022-07-25 17:09:58 -04:00

4.2 KiB

mc mb

minio

Table of Contents

mc mb

Syntax

The mc mb command creates a new bucket or directory at the specified path.

You can also use mc mb against the local filesystem to produce similar results to the mkdir -p commandline tool.

EXAMPLE

The following command creates a new bucket mydata on the myminio MinIO deployment. The command creates the bucket with object locking enabled <minio-object-locking>.

mc mb --with-locks myminio/mydata

SYNTAX

The command has the following syntax:

mc [GLOBALFLAGS] mb                   \
                 [--ignore-existing]  \
                 [--region "string"]  \
                 [--with-lock]        \
                 ALIAS

Parameters

ALIAS

Required The MinIO or other S3-compatible service on which to create the new bucket.

For creating a bucket on MinIO, specify the alias <alias> and the name of the bucket. For example:

mc mb play/mybucket

For creating a directory on a local filesystem, specify the full path to that directory. For example:

mc mb ~/mydata/mydir

--ignore-existing, p

Directs mc mb to do nothing if the bucket or directory already exists.

--region

The region in which to create the specified bucket. Has no effect if the specified ~mc mb ALIAS is a filesystem directory.

--with-lock, l

Enables object locking <minio-object-locking> on the specified bucket. Has no effect if the specified ALIAS is a standalone <minio-installation-comparison> MinIO deployments or a filesystem directory.

Important

You can only enable object locking when creating the bucket. Buckets created without object locking cannot use Bucket Lifecycle Management <minio-lifecycle-management> or Bucket Object Locking <minio-object-locking> functionality.

Global Flags

Examples

Create Bucket

Use mc mb to create a bucket on an S3-compatible host. The ~mc mb --with-lock option creates the bucket with locking enabled:

mc mb --with-lock ALIAS/BUCKET
  • Replace ALIAS <mc mb ALIAS> with the alias <mc alias> of the S3-compatible host.
  • Replace BUCKET <mc mb ALIAS> with the bucket to create.

Behavior

Bucket Limits for Non-MinIO S3 Services

Certain S3 services may restrict the number of buckets a given user or account can create. For example, Amazon S3 limits each account to 100 buckets <BucketRestrictions.html>. mc mb may return an error if the user has reached bucket limits on the target S3 service.

MinIO Object Storage deployments do not place any limits on the number of buckets each user can create.

Enable Object Locking at Bucket Creation

MinIO follows AWS S3 behavior <object-lock-overview.html#object-lock-bucket-config> where you must enable object locking <minio-object-locking> at bucket creation. Buckets created without object can never enable object retention or locking.

Enabling bucket locking does not set any object locking or retention settings. Consider enabling bucket locking as standard practice.

S3 Compatibility