[ceph-users] Manually deleting an RGW bucket

Sean Purdy s.purdy at cv-library.co.uk
Mon Oct 1 03:14:30 PDT 2018


On Sat, 29 Sep 2018, Konstantin Shalygin said:
> > How do I delete an RGW/S3 bucket and its contents if the usual S3 API commands don't work?
> > 
> > The bucket has S3 delete markers that S3 API commands are not able to remove, and I'd like to reuse the bucket name.  It was set up for versioning and lifecycles under ceph 12.2.5 which broke the bucket when a reshard happened.  12.2.7 allowed me to remove the regular files but not the delete markers.
> > 
> > There must be a way of removing index files and so forth through rados commands.
> 
> 
> What error actually is?
> 
> For delete bucket you should delete all bucket objects ("s3cmd rm -rf
> s3://bucket/") and multipart uploads.


No errors, but I can't remove delete markers from the versioned bucket.


Here's the bucket:

$ aws --profile=mybucket --endpoint-url http://myserver/ s3 ls s3://mybucket/

(no objects returned)

Try removing the bucket:

$ aws --profile=mybucket --endpoint-url http://myserver/ s3 rb s3://mybucket/
remove_bucket failed: s3://mybucket/ An error occurred (BucketNotEmpty) when calling the DeleteBucket operation: Unknown

So the bucket is not empty.

List object versions:

$ aws --profile=mybucket --endpoint-url http://myserver/ s3api list-object-versions --bucket mybucket --prefix someprefix/0/0

Shows lots of delete markers from the versioned bucket:

        {
            "Owner": {
                "DisplayName": "mybucket bucket owner", 
                "ID": "mybucket"
            }, 
            "IsLatest": true, 
            "VersionId": "ZB8ty9c3hxjxV5izmIKM1QwDR6fwnsd", 
            "Key": "someprefix/0/0/00fff6df-863d-48b5-9089-cc6e7c5997e7", 
        }
         
Let's try removing that delete marker object:

$ aws --profile=mybucket --endpoint-url http://myserver/ s3api delete-object --bucket mybucket --key someprefix/0/0/00fff6df-863d-48b5-9089-cc6e7c5997e7 --version-id ZB8ty9c3hxjxV5izmIKM1QwDR6fwnsd

Returns 0, has it worked?

$ aws --profile=mybucket --endpoint-url http://myserver/ s3api list-object-versions --bucket mybucket --prefix someprefix/0/0/00fff6df-863d-48b5-9089-cc6e7c5997e7

No:

    "DeleteMarkers": [
        {
            "Owner": {
                "DisplayName": "static bucket owner", 
                "ID": "static"
            }, 
            "IsLatest": true, 
            "VersionId": "ZB8ty9c3hxjxV5izmIKM1QwDR6fwnsd", 
            "Key": "candidate-photo/0/0/00fff6df-863d-48b5-9089-cc6e7c5997e7", 
            "LastModified": "2018-09-17T16:19:58.187Z"
        }
    ]


So how do I get rid of the delete markers to empty the bucket?  This is my problem.

Sean


More information about the ceph-users mailing list