Help Center/ Object Storage Service/ FAQs/ Buckets and Objects/ Why Can't I Delete a Bucket?
Updated on 2024-10-15 GMT+08:00

Why Can't I Delete a Bucket?

Problem Description

A bucket cannot be deleted.

Problem Analysis

Possible causes are described here in order of how likely they are to occur. To locate the root cause as fast as possible, go through the list in order, from most likely to least.

If the fault persists after a possible cause is rectified, move down the list to the next most likely cause.

Figure 1 Analysis process
Table 1 Problem Analysis

Possible Cause

Solution

Local network is faulty.

Check whether the network connectivity between the local computer and OBS is normal. If the network is faulty, restore the network connection.

There are objects in the bucket.

For details, see Deleting Objects in a Bucket.

There are objects that were not permanently deleted from the bucket.

For details, see Permanently Deleting Deleted Objects from a Bucket.

There are object fragments in the bucket.

For details, see Deleting Fragments from a Bucket.

The current account does not have the permissions required to delete the bucket.

For details, see Checking Whether the Current Account Has the Permission to Delete the Bucket.

Deleting Objects in a Bucket

The following procedure describes how to manually empty a bucket on OBS Console. For details about how to empty a bucket using other methods (obsutil or SDKs), see Deleting Objects. You can also use the lifecycle management to batch delete all objects in a bucket.

  1. In the bucket list on OBS Console, click the bucket you need to delete objects from. The Objects page is displayed.
  2. Select all of the objects and click Delete above the object list.
    Figure 2 Deleting all objects

After all objects are deleted, try to delete the bucket again. If the bucket still cannot be deleted, go to the next step.

Permanently Deleting Deleted Objects from a Bucket

If versioning is or was enabled for a bucket, deleted objects may still exist in the bucket. In this case, you need to permanently delete deleted objects in the bucket. For details about deleted objects, see Deleting Objects When Versioning Is Enabled.

  1. In the bucket list on OBS Console, click the bucket you want to permanently delete the deleted objects from. The Objects page is displayed.
  2. Click the Deleted Objects tab. The deleted object list is displayed.
  3. Select all deleted objects and click Delete above the list.
    Figure 3 Deleting all deleted objects

After all deleted objects are permanently deleted, try to delete the bucket again. If the bucket still cannot be deleted, check the bucket for fragments.

Deleting Fragments from a Bucket

Fragments refer to incomplete data in a bucket. Data is uploaded to OBS in multipart mode. In the following common and other scenarios, an upload fails and fragments are generated. You can clear these fragments to free up storage space.

  • The network is in poor conditions, and the connection to the OBS server is interrupted frequently.
  • The upload task is manually suspended.
  • The device is faulty.
  • The device is powered off suddenly.

The following describes how to manually delete fragments on OBS Console. For details about how to delete fragments in other ways, see Managing Fragments.

  1. In the bucket list on OBS Console, click the bucket containing fragments. The Objects page is displayed.
  2. Click the Fragments tab. The fragment list is displayed.
  3. Select all fragments and click Delete above the list.
    Figure 4 Deleting all fragments

After deleting all fragments, try deleting the bucket again. If the bucket still cannot be deleted, you may need to check the permissions.

Checking Whether the Current Account Has the Permission to Delete the Bucket

By default, only the bucket owner has the permission needed to delete a bucket. However, the bucket owner can also grant other users this permission (DeleteBucket).

  1. Check whether the current account that you use is the bucket owner.
    1. In the bucket list on OBS Console, click the bucket you want to delete. The Objects page is displayed.
    2. In the navigation pane, choose Overview.
    3. In the Basic Information area, find the account ID (the bucket owner's account ID).
      Figure 5 Viewing the bucket owner
    4. Move the mouse over your username displayed in the upper right corner. Choose My Credentials from the drop-down list, and find the account ID.
      Figure 6 Viewing the current account ID
      • If the current account ID is consistent with the bucket owner account ID, and you logged in to the console using that account, not as an IAM user, then the current account is the bucket owner. If the bucket still cannot be deleted, submit a service ticket to get technical support.
      • If the two account IDs are inconsistent, or you logged in to the console as an IAM user, then you are not the bucket owner. In this case, continue to the next step.
  2. Contact the bucket owner to check whether the user you are using has been granted the permission to delete the bucket.
    • If the user does not have the permission, ask the bucket owner to grant it.
    • If the user has the permission to delete the bucket but still cannot delete the bucket, submit a service ticket to get technical support.

Submitting a Service Ticket

If the problem persists, submit a service ticket to contact Huawei Cloud customer service for assistance.