MinIO/S3/R2 ghost files

Sometimes a multi-part upload will fail and result in ghost files. Your bucket will indicate it has contents/cannot be deleted, but you can't see anything.

Tested on MinIO, S3, and R2.

$ sudo apt install awscli

$ aws configure
AWS Access Key ID [None]: xxxxxxxxxxx
AWS Secret Access Key [None]: xxxxxxxxxxxxx
Default region name [None]:
Default output format [None]:

$ aws s3api list-multipart-uploads --bucket BUCKET-NAME --endpoint-url https://YOURENDPOINT.r2.cloudflarestorage.com/BUCKET-NAME

$ aws s3api list-multipart-uploads --bucket BUCKET-NAME --endpoint-url https://YOURENDPOINT.r2.cloudflarestorage.com/BUCKET-NAME
{
    "Uploads": [
        {
            "UploadId": "REALLY-LONG-ID-STRING",
            "Key": "folder/file.extension",
            "Initiated": "2023-01-24T12:07:30.202000+00:00",
            "StorageClass": "STANDARD",
            "Owner": {
                "DisplayName": "API-KEY",
                "ID": "API-KEY"
            },
            "Initiator": {
                "ID": "API-KEY",
                "DisplayName": "API-KEY"
            }
        }
    ]
}

$ aws s3api abort-multipart-upload --bucket BUCKET-NAME --endpoint-url https://YOURENDPOINT.r2.cloudflarestorage.com --upload-id "REALLY-LONG-ID-STRING" --key "folder/file.extension"

$ aws s3api list-multipart-uploads --bucket BUCKET-NAME --endpoint-url https://YOURENDPOINT.r2.cloudflarestorage.com/BUCKET-NAME
(this should be empty and/or your previous UploadID won't exist)

Last updated