ECS: How to Delete a S3 Bucket with Many Objects in it

Summary: A S3 bucket has many objects but should be deleted. This article describes how to remove all objects from a bucket and delete the bucket finally.

Αυτό το άρθρο ισχύει για Αυτό το άρθρο δεν ισχύει για Αυτό το άρθρο δεν συνδέεται με κάποιο συγκεκριμένο προϊόν. Δεν προσδιορίζονται όλες οι εκδόσεις προϊόντων σε αυτό το άρθρο.

Instructions

CAUTION: This procedure empties all objects in the target bucket. Data cannot be recovered, use with care.


Limitations to below operations:
  • Objects under ECS retention cannot be deleted.
  • Objects under Object Lock retention cannot be deleted.
  • File system enabled buckets require version 3.8.1 or later. 

Recommended option: Version 3.8 or later:
In version 3.8 of ECS Software, Dell introduced the simplified bucket deleteNow objects and the bucket can be deleted using the REST API or an empty bucket S3 string using x-emc-headers. Dell Technologies recommends upgrading to 3.8. and using the simplified bucket delete over life cycle delete.

Using the "simplified bucket delete" using ECS UI (Requires 3.8.1.0 or later)
Version 3.8.1.x and later allows deletion of the bucket with content from the ECS UI with appropriate permissions. Browse to the bucket and select delete from the drop-down. Select Delete ENTIRE contents including the selected bucket and confirm. 

Using the "simplified bucket delete" using ECS UI (Requires 3.8.1.0 or later)

Using the simplified bucket delete using REST API.
Check the latest REST API Guide for reference.

Using the "simplified bucket delete" using REST API.

Example for sending the rest API call using curl from ECS:

Command:

# curl -k -H "$token" -X POST https://<hostname-or-ip>:4443/object/bucket/<bucketname>/deactivate?namespace=<namespace>\&emptyBucket=true

Example:

curl -v -k -H "$token" -X POST https://10.60.x.xx:4443/object/bucket/ExampleBucketRest/deactivate?namespace=b_mathias_ns\&emptyBucket=true

To monitor:

To monitor bucket delete

Command:

# curl -k -H "$token" -X GET https://<hostname-or-ip>:4443/object/bucket/<bucketname>/empty-bucket-status?namespace=<namespace> |xmllint --format -

Example:

Started:
mathias@client:/usr/share/s3curl$ curl -k -H "$token" -X GET https://10.60.x.xx:4443/object/bucket/ExampleBucketRest/empty-bucket-status?namespace=b_mathias_ns |xmllint --format -
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<empty_bucket_status>
  <status>PENDING</status>
  <created>1707411798889</created>
  <last_updated>1707411798889</last_updated>
  <entries_deleted>0</entries_deleted>
  <failed_to_delete_due_to_retention>0</failed_to_delete_due_to_retention>
  <failed_to_delete_due_to_permission>0</failed_to_delete_due_to_permission>
  <failed_to_delete_due_to_dangling xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
  <failed_to_delete_due_to_other>0</failed_to_delete_due_to_other>
  <message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
</empty_bucket_status>

Running:
mathias@client:/usr/share/s3curl$ curl -k -H "$token" -X GET https://10.60.x.xx:4443/object/bucket/ExampleBucketRest/empty-bucket-status?namespace=b_mathias_ns |xmllint --format -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   629  100   629    0     0   2431      0 --:--:-- --:--:-- --:--:--  2437
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<empty_bucket_status>
  <status>IN_PROGRESS</status>
  <created>1707411798889</created>
  <last_updated>1707411828897</last_updated>
  <entries_deleted>1337</entries_deleted>
  <failed_to_delete_due_to_retention>0</failed_to_delete_due_to_retention>
  <failed_to_delete_due_to_permission>0</failed_to_delete_due_to_permission>
  <failed_to_delete_due_to_dangling xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
  <failed_to_delete_due_to_other>0</failed_to_delete_due_to_other>
  <message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
</empty_bucket_status>

Completed:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error>
  <code>1004</code>
  <description>Request parameter cannot be found</description>
  <details>Unable to find entity with the given id ExampleBucketRest</details>
  <retryable>false</retryable>
</error>

The error above is expected as the bucket is no longer found.

Using the simplified bucket delete using S3:

  1. Check the latest data access guide for more details.
  2. See v3.8 Data Access Guide.

Using the "simplified bucket delete" using S3 

The fastest way to address a bucket with this option is by s3curl.
 

Caution: s3curl is already installed on the ECS Nodes, but it should not be used for this operation. The x-emc headers are not fully functional at the moment.
 
s3curl is available on GitHub for local installations. This version is used for including x-emc-headers https://github.com/EMCECS/s3curl/blob/master/s3curl.pl This hyperlink is taking you to a website outside of Dell Technologies.

The modified version of s3curl.pl is planned to be added to ECS code in a future version and this KB is updated.

When s3curl is configured, proceed with the following steps. Keep in mind that Data cannot be recovered!
  1. Start a simplified bucket delete using s3curl:
Command:
./s3curl --id=<alias> --DELETE -- http://<hostname-or-ip>:9020/<bucketname> -H "x-emc-empty-bucket:true"

Example:

mathias@client:/usr/share/s3curl$ ./s3curl.pl --id=b_mathias_iam --DELETE -- http://10.60.x.xx:9020/ExampleBucket -H "x-emc-empty-bucket:true"

Monitor Bucket Delete:

./s3curl.pl --id=<alias> http://<hostname-or-ip>:9020/<bucketname>?empty-bucket-status |xmllint --format -

Example:

mathias@client:/usr/share/s3curl$ ./s3curl.pl --id=b_mathias_iam -- http://10.60.x.xx:9020/ExampleBucket?empty-bucket-status |xmllint --format -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   474  100   474    0     0   3128      0 --:--:-- --:--:-- --:--:--  3139
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<EmptyBucketStatus xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
  <Status>PENDING</Status>
  <Created>2024-02-08T16:21:53.849Z</Created>
  <LastUpdated>2024-02-08T16:21:53.849Z</LastUpdated>
  <EntriesDeleted>0</EntriesDeleted>
  <FailedToDeleteDueToRetention>0</FailedToDeleteDueToRetention>
  <FailedToDeleteDueToPermission>0</FailedToDeleteDueToPermission>
  <FailedToDeleteDueToOther>0</FailedToDeleteDueToOther>

Running:
mathias@client:/usr/share/s3curl$ ./s3curl.pl --id=b_mathias_iam -- http://10.60.x.xx:9020/ExampleBucket?empty-bucket-status |xmllint --format -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   478  100   478    0     0   3883      0 --:--:-- --:--:-- --:--:--  3886
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<EmptyBucketStatus xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
  <Status>IN_PROGRESS</Status>
  <Created>2024-02-08T16:21:53.849Z</Created>
  <LastUpdated>2024-02-08T16:22:23.899Z</LastUpdated>
  <EntriesDeleted>1304</EntriesDeleted>
  <FailedToDeleteDueToRetention>0</FailedToDeleteDueToRetention>
  <FailedToDeleteDueToPermission>0</FailedToDeleteDueToPermission>
  <FailedToDeleteDueToOther>0</FailedToDeleteDueToOther>
</EmptyBucketStatus>

Completed:
mathias@client:/usr/share/s3curl$ ./s3curl.pl --id=b_mathias_iam -- http://10.60.x.xx:9020/ExampleBucket?empty-bucket-status |xmllint --format -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   180    0   180    0     0   1300      0 --:--:-- --:--:-- --:--:--  1304
<?xml version="1.0"?>
<Error>
  <Code>NoSuchBucket</Code>
  <Message>The specified bucket does not exist</Message>
  <Resource>ExampleBucket</Resource>
  <RequestId>0a3c0812:18d77e3a715:2d7:1f33</RequestId>
</Error>


For code versions before 3.8, upgrade for availability of the above options.

Επηρεαζόμενα προϊόντα

ECS Appliance

Προϊόντα

ECS Appliance
Ιδιότητες άρθρου
Article Number: 000014767
Article Type: How To
Τελευταία τροποποίηση: 21 Αυγ 2025
Version:  8
Βρείτε απαντήσεις στις ερωτήσεις σας από άλλους χρήστες της Dell
Υπηρεσίες υποστήριξης
Ελέγξτε αν η συσκευή σας καλύπτεται από τις Υπηρεσίες υποστήριξης.