Sample code for 30+ languages & platforms
Visual Basic 6.0 Requires Chilkat v11.6.0+

Amazon Glacier: Resume an Archive Download with Verified Chunks

See more Amazon Glacier Examples

For existing Amazon Glacier vault customers. The standalone vault service is closed to new customers. These examples use its REST API version 2012-06-01, not the S3 bucket APIs used by S3 Glacier storage classes. See AWS service guidance.

Downloads a completed full-archive retrieval job in fixed 8 MiB ranges. Set the job ID, cache directory, and final path. Start with an empty, private cache directory on the same filesystem as the final output, then rerun with exactly the same settings to resume. Only one process may use the directory. No new retrieval job is initiated, even if the old job expires.

A saved identity binds progress to region, vault, job, archive ID, size, tree hash, chunk size, and final path. Every cached chunk is rehashed and its length and range checked before reuse. New chunks require HTTP 206, exact Content-Range and Content-Length, actual length, and a matching response tree hash before their temporary file is committed. An interrupted chunk is downloaded again; already verified chunks are retained. A damaged checkpoint or cached chunk stops with an explanation. Local cache files and receipts must be protected from other writers.

After downloading, the example assembles one chunk at a time and checks the entire file's byte count and archive tree hash before renaming it. Interrupted assembly is rebuilt from the cache. Existing final output is accepted only if it matches; other files are not overwritten. Chunks remain for inspection or manual cleanup. Allow disk space for both the complete chunk cache and assembled archive, plus one temporary chunk. A disk-full, network, or checksum failure is not success.

Uses decimal strings and bounded 32-bit arithmetic for archive offsets through the 40 TiB archive limit, including beyond 2 GiB. This produces up to 5,242,880 chunk files plus receipts at that limit; larger power-of-two chunks are more practical for very large archives, but require adapting the arithmetic and checkpoint schema. Empty archives use the single-download example. For partial retrieval jobs use range output download instead.

Requires glacier:DescribeJob and glacier:GetJobOutput. Resume promptly while output is retained (at least 24 hours after successful completion). If it has expired, initiate a new retrieval deliberately and use a new cache directory; cached chunks are not automatically transferred to a different job.

Uses AWS Signature Version 4 with service glacier. Set the region once; the example builds the commercial AWS endpoint. Other partitions require the appropriate endpoint suffix. /-/ selects the signing account; change the vault name and IDs to your own resources. Load private qa_data/aws/glacier.json with string fields access_key, secret_key, and session_token for temporary credentials. Prefer short-lived role credentials. This sample does not discover profiles or refresh credentials. TLS certificate verification is enabled explicitly.

Checks transport completion, the operation-specific HTTP status, and parsed data separately. Inspect full diagnostics privately. Renew expired credentials; use bounded backoff with jitter for retryable reads. Uploads and job initiation can succeed before a connection fails, so do not blindly resubmit them. Configure IAM permissions for only the required operations and vault resources.

AWS reference

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
'  Assumes Chilkat is unlocked. See Global Unlock Sample.
Dim success As Long
success = 0
'  Private configuration, not a file in public web content or source control.
'  Load current IAM credentials authorized for the Glacier operation.
Dim credentials As New ChilkatJsonObject
credentials.Strict = 1
success = credentials.LoadFile("qa_data/aws/glacier.json")
If (success <> 1) Then
    Debug.Print "Could not load private AWS credentials."
    Exit Sub
End If

If ((credentials.JsonTypeOf("access_key") <> 1) Or (credentials.StringOf("access_key") = "")) Then
    Debug.Print "Missing or invalid access_key."
    Exit Sub
End If

If ((credentials.JsonTypeOf("secret_key") <> 1) Or (credentials.StringOf("secret_key") = "")) Then
    Debug.Print "Missing or invalid secret_key."
    Exit Sub
End If

'  Set this once to the region containing the vault.
Dim region As String
region = "us-west-2"
Dim endpoint As New ChilkatStringBuilder
success = endpoint.Append("glacier.")
success = endpoint.Append(region)
success = endpoint.Append(".amazonaws.com")
Dim aws As New ChilkatAuthAws
aws.AccessKey = credentials.StringOf("access_key")
aws.SecretKey = credentials.StringOf("secret_key")
aws.Region = region
aws.ServiceName = "glacier"
aws.SignatureVersion = 4
Dim rest As New ChilkatRest
rest.ConnectTimeoutMs = 20000
rest.IdleTimeoutMs = 60000
success = rest.SetAuthAws(aws)
If (success <> 1) Then
    Debug.Print "Could not configure AWS signing."
    Exit Sub
End If

'  Temporary IAM/STS credentials require their session token on every signed request.
'  Include the token in the signed query. Keep request URLs and diagnostics private.
'  Leave session_token absent or empty only for credentials that do not have one.
If (credentials.HasMember("session_token") = 1) Then
    If (credentials.JsonTypeOf("session_token") <> 1) Then
        Debug.Print "session_token must be a string."
        Exit Sub
    End If

    If (credentials.StringOf("session_token") <> "") Then
        success = rest.AddQueryParam("X-Amz-Security-Token",credentials.StringOf("session_token"))
        If (success <> 1) Then
            Debug.Print "Could not set the session-token parameter."
            Exit Sub
        End If

    End If

End If

'  Supply a Socket to explicitly enable TLS certificate verification.
Dim connection As New ChilkatSocket
connection.RequireSslCertVerify = 1
connection.MaxReadIdleMs = 60000
connection.MaxSendIdleMs = 60000
success = connection.Connect(endpoint.GetAsString(),443,1,20000)
If (success <> 1) Then
    Debug.Print "TLS connection failed; inspect diagnostics privately."
    Exit Sub
End If

success = rest.UseConnection(connection,1)
If (success <> 1) Then
    Debug.Print "Could not attach the TLS connection."
    Exit Sub
End If

success = rest.AddHeader("x-amz-glacier-version","2012-06-01")
If (success <> 1) Then
    Debug.Print "Could not set x-amz-glacier-version."
    Exit Sub
End If

'  A hyphen selects the account belonging to the signing credentials.
'  Use the original, URL-safe vault name and IDs returned by Glacier.
success = rest.AddPathParam("{vault}","chilkat")
If (success <> 1) Then
    Debug.Print "Could not set vault name."
    Exit Sub
End If

Dim result As New ChilkatJsonObject
result.Strict = 1
Dim error As New ChilkatJsonObject
error.Strict = 1
Dim responseBody As New ChilkatStringBuilder
Dim jobId As String
jobId = "YOUR_JOB_ID"
success = rest.AddPathParam("{job}",jobId)
If (success <> 1) Then
    Debug.Print "Could not set job ID."
    Exit Sub
End If

success = rest.FullRequestNoBodySb("GET","/-/vaults/{vault}/jobs/{job}",responseBody)
If (success <> 1) Then
    Debug.Print "Request did not complete; inspect diagnostics privately. Check state before retrying a change."
    Exit Sub
End If

If (rest.ResponseStatusCode <> 200) Then
    Debug.Print "Glacier HTTP status: " & rest.ResponseStatusCode
    success = error.LoadSb(responseBody)
    If (success = 1) Then
        If (error.JsonTypeOf("code") = 1) Then
            Debug.Print "AWS error code: " & error.StringOf("code")
        End If

    End If

    Debug.Print "AWS request ID: " & rest.ResponseHdrByName("x-amzn-RequestId")
    '  Inspect full errors privately. An HTTP error is not a successful operation.
    Exit Sub
End If

success = result.LoadSb(responseBody)
If (success <> 1) Then
    Debug.Print "Expected valid JSON response."
    Exit Sub
End If

If (result.JsonTypeOf("Completed") <> 5) Then
    Debug.Print "Missing or invalid Completed."
    Exit Sub
End If

If (result.JsonTypeOf("StatusCode") <> 1) Then
    Debug.Print "Missing or invalid StatusCode."
    Exit Sub
End If

If (result.StringOf("StatusCode") = "") Then
    Debug.Print "Empty StatusCode."
    Exit Sub
End If

If ((result.BoolOf("Completed") <> 1) Or (result.StringOf("StatusCode") <> "Succeeded")) Then
    Debug.Print "Job is not successfully complete. Resume later only if InProgress."
    Exit Sub
End If

If (result.StringOf("Action") <> "ArchiveRetrieval") Then
    Debug.Print "Wrong job type."
    Exit Sub
End If

If (result.JsonTypeOf("SHA256TreeHash") <> 1) Then
    Debug.Print "Missing or invalid SHA256TreeHash."
    Exit Sub
End If

If (result.StringOf("SHA256TreeHash") = "") Then
    Debug.Print "Empty SHA256TreeHash."
    Exit Sub
End If

If (result.JsonTypeOf("ArchiveSizeInBytes") <> 2) Then
    Debug.Print "Missing or invalid ArchiveSizeInBytes."
    Exit Sub
End If

If (result.JsonTypeOf("ArchiveId") <> 1) Then
    Debug.Print "Missing or invalid ArchiveId."
    Exit Sub
End If

If (result.StringOf("ArchiveId") = "") Then
    Debug.Print "Empty ArchiveId."
    Exit Sub
End If

If (result.JsonTypeOf("ArchiveSHA256TreeHash") <> 1) Then
    Debug.Print "Missing or invalid ArchiveSHA256TreeHash."
    Exit Sub
End If

If (result.StringOf("ArchiveSHA256TreeHash") = "") Then
    Debug.Print "Empty ArchiveSHA256TreeHash."
    Exit Sub
End If

Dim expectedSize As String
expectedSize = result.StringOf("ArchiveSizeInBytes")
Dim expectedHash As String
expectedHash = result.StringOf("ArchiveSHA256TreeHash")
If (result.StringOf("SHA256TreeHash") <> expectedHash) Then
    Debug.Print "Use a full-archive retrieval job for this resumable example."
    Exit Sub
End If

'  Fixed 8 MiB chunks are power-of-two and tree-hash aligned.
'  Decimal long division avoids 32-bit overflow in every generated language.
Dim chunkSize As Long
chunkSize = 8388608
Dim chunkCount As Long
chunkCount = 0
Dim remainder As Long
remainder = 0
Dim position As Long
position = 0
Dim sizeText As New ChilkatStringBuilder
Dim decimalDigits As New ChilkatStringBuilder
Dim digit As New ChilkatStringBuilder
success = sizeText.Append(expectedSize)
success = decimalDigits.Append("0123456789")
If ((sizeText.Length = 0) Or (sizeText.Length > 14)) Then
    Debug.Print "Invalid archive size."
    Exit Sub
End If

Do While (position < sizeText.Length)
    success = digit.SetString(sizeText.GetRange(position,1,0))
    If (decimalDigits.Contains(digit.GetAsString(),1) <> 1) Then
        Debug.Print "Invalid decimal archive size."
        Exit Sub
    End If

    remainder = remainder * 10 + digit.IntValue
    '  At most nine subtractions per digit; avoids language-specific division.
    chunkCount = chunkCount * 10
    Do While (remainder >= chunkSize)
        chunkCount = chunkCount + 1
        remainder = remainder - chunkSize
    Loop
    position = position + 1
Loop
If ((chunkCount > 5242880) Or ((chunkCount = 5242880) And (remainder <> 0))) Then
    Debug.Print "Archive exceeds the 40 TiB service limit."
    Exit Sub
End If

If ((chunkCount = 0) And (remainder = 0)) Then
    Debug.Print "Use the single-download example for an empty archive."
    Exit Sub
End If

If (remainder <> 0) Then
    chunkCount = chunkCount + 1
End If

'  This dedicated directory belongs to ONE job. Use a new empty directory
'  when selecting another job. Run only one process against it at a time.
Dim cacheDir As String
cacheDir = "qa_output/glacier-download"
Dim finalPath As String
finalPath = "qa_output/archive-resumed.dat"
Dim files As New CkFileAccess
success = files.DirEnsureExists(cacheDir)
If (success <> 1) Then
    Debug.Print "Could not create private download directory."
    Exit Sub
End If

Dim path As New ChilkatStringBuilder
success = path.Append(cacheDir)
success = path.Append("/manifest.json")
Dim manifestPath As String
manifestPath = path.GetAsString()
Dim manifest As New ChilkatJsonObject
manifest.Strict = 1
Dim identity As New ChilkatJsonObject
success = identity.UpdateString("version","1")
If (success <> 1) Then
    Debug.Print "Could not set version."
    Exit Sub
End If

success = identity.UpdateString("region",region)
If (success <> 1) Then
    Debug.Print "Could not set region."
    Exit Sub
End If

success = identity.UpdateString("vault","chilkat")
If (success <> 1) Then
    Debug.Print "Could not set vault."
    Exit Sub
End If

success = identity.UpdateString("jobId",jobId)
If (success <> 1) Then
    Debug.Print "Could not set jobId."
    Exit Sub
End If

success = identity.UpdateString("archiveId",result.StringOf("ArchiveId"))
If (success <> 1) Then
    Debug.Print "Could not set archiveId."
    Exit Sub
End If

success = identity.UpdateString("size",expectedSize)
If (success <> 1) Then
    Debug.Print "Could not set size."
    Exit Sub
End If

success = identity.UpdateString("treeHash",expectedHash)
If (success <> 1) Then
    Debug.Print "Could not set treeHash."
    Exit Sub
End If

success = identity.UpdateString("chunkSize","8388608")
If (success <> 1) Then
    Debug.Print "Could not set chunkSize."
    Exit Sub
End If

success = identity.UpdateString("finalPath",finalPath)
If (success <> 1) Then
    Debug.Print "Could not set finalPath."
    Exit Sub
End If

If (files.FileExists(manifestPath) = 1) Then
    success = manifest.LoadFile(manifestPath)
    If (success <> 1) Then
        Debug.Print "Invalid checkpoint. Preserve the cache and inspect it before restarting."
        Exit Sub
    End If

    If (manifest.StringOf("version") <> identity.StringOf("version")) Then
        Debug.Print "Checkpoint belongs to different download settings. Use a new empty cache directory."
        Exit Sub
    End If

    If (manifest.StringOf("region") <> identity.StringOf("region")) Then
        Debug.Print "Checkpoint belongs to different download settings. Use a new empty cache directory."
        Exit Sub
    End If

    If (manifest.StringOf("vault") <> identity.StringOf("vault")) Then
        Debug.Print "Checkpoint belongs to different download settings. Use a new empty cache directory."
        Exit Sub
    End If

    If (manifest.StringOf("jobId") <> identity.StringOf("jobId")) Then
        Debug.Print "Checkpoint belongs to different download settings. Use a new empty cache directory."
        Exit Sub
    End If

    If (manifest.StringOf("archiveId") <> identity.StringOf("archiveId")) Then
        Debug.Print "Checkpoint belongs to different download settings. Use a new empty cache directory."
        Exit Sub
    End If

    If (manifest.StringOf("size") <> identity.StringOf("size")) Then
        Debug.Print "Checkpoint belongs to different download settings. Use a new empty cache directory."
        Exit Sub
    End If

    If (manifest.StringOf("treeHash") <> identity.StringOf("treeHash")) Then
        Debug.Print "Checkpoint belongs to different download settings. Use a new empty cache directory."
        Exit Sub
    End If

    If (manifest.StringOf("chunkSize") <> identity.StringOf("chunkSize")) Then
        Debug.Print "Checkpoint belongs to different download settings. Use a new empty cache directory."
        Exit Sub
    End If

    If (manifest.StringOf("finalPath") <> identity.StringOf("finalPath")) Then
        Debug.Print "Checkpoint belongs to different download settings. Use a new empty cache directory."
        Exit Sub
    End If

Else
    Dim cacheContents As New CkDirTree
    cacheContents.BaseDir = cacheDir
    cacheContents.Recurse = 0
    success = cacheContents.BeginIterate()
    If ((success = 1) Or (cacheContents.DoneIterating <> 1)) Then
        Debug.Print "First run requires an empty, readable cache directory."
        Exit Sub
    End If

    success = identity.WriteFile(manifestPath)
    If (success <> 1) Then
        Debug.Print "Could not save download identity."
        Exit Sub
    End If

End If

Dim crypt As New ChilkatCrypt2
crypt.HashAlgorithm = "sha256-tree-hash"
crypt.EncodingMode = "hexlower"
If (files.FileExists(finalPath) = 1) Then
    Dim finalSize As String
    finalSize = files.FileSizeStr(finalPath)
    Dim finalHash As String
    finalHash = crypt.HashFileENC(finalPath)
    If ((crypt.LastMethodSuccess <> 1) Or (finalSize <> expectedSize) Or (finalHash <> expectedHash)) Then
        Debug.Print "Existing final file differs; choose another final output path."
        Exit Sub
    End If

    Debug.Print "Archive already downloaded and verified."
    Exit Sub
End If

Dim rangeHeader As New ChilkatStringBuilder
Dim contentRange As New ChilkatStringBuilder
Dim byteCount As New ChilkatStringBuilder
Dim receipt As New ChilkatJsonObject
receipt.Strict = 1
Dim chunkIndex As Long
chunkIndex = 0
Dim byteHigh As Long
byteHigh = 0
Dim byteLow As Long
byteLow = 0
Dim endHigh As Long
Dim endLow As Long
Dim range As New ChilkatStringBuilder
Dim digits As New ChilkatStringBuilder
Do While (chunkIndex < chunkCount)
    Dim chunkBytes As Long
    chunkBytes = chunkSize
    If ((chunkIndex = chunkCount - 1) And (remainder <> 0)) Then
        chunkBytes = remainder
    End If

    range.Clear 
    digits.Clear 
    success = digits.AppendInt(byteLow)
    If (byteHigh > 0) Then
        Do While (digits.Length < 9)
            success = digits.Prepend("0")
        Loop
        success = range.AppendInt(byteHigh)
    End If

    success = range.Append(digits.GetAsString())
    success = range.Append("-")
    endHigh = byteHigh
    endLow = byteLow + chunkBytes - 1
    If (endLow >= 1000000000) Then
        endLow = endLow - 1000000000
        endHigh = endHigh + 1
    End If

    digits.Clear 
    success = digits.AppendInt(endLow)
    If (endHigh > 0) Then
        Do While (digits.Length < 9)
            success = digits.Prepend("0")
        Loop
        success = range.AppendInt(endHigh)
    End If

    success = range.Append(digits.GetAsString())
    Dim rangeKey As String
    rangeKey = range.GetAsString()
    success = rangeHeader.SetString("bytes=")
    success = rangeHeader.Append(rangeKey)
    success = contentRange.SetString("bytes ")
    success = contentRange.Append(rangeKey)
    success = contentRange.Append("/")
    success = contentRange.Append(expectedSize)
    byteCount.Clear 
    success = byteCount.AppendInt(chunkBytes)
    success = path.SetString(cacheDir)
    success = path.Append("/chunk-")
    success = path.AppendInt(chunkIndex)
    Dim chunkPath As String
    chunkPath = path.GetAsString()
    success = path.Append(".json")
    Dim receiptPath As String
    receiptPath = path.GetAsString()
    success = path.SetString(chunkPath)
    success = path.Append(".part")
    Dim temporaryPath As String
    temporaryPath = path.GetAsString()
    If (files.FileExists(chunkPath) = 1) Then
        success = receipt.LoadFile(receiptPath)
        If (success <> 1) Then
            Debug.Print "Cached chunk lacks a valid receipt. Preserve the cache and inspect it."
            Exit Sub
        End If

        Dim cachedHash As String
        cachedHash = crypt.HashFileENC(chunkPath)
        If ((crypt.LastMethodSuccess <> 1) Or (cachedHash <> receipt.StringOf("treeHash")) Or (receipt.StringOf("range") <> rangeKey) Or (files.FileSizeStr(chunkPath) <> byteCount.GetAsString())) Then
            Debug.Print "Cached chunk failed verification. Remove only that chunk and its receipt, then rerun."
            Exit Sub
        End If

        Debug.Print "Reusing verified chunk: " & chunkIndex
    Else
        success = rest.AddHeader("Range",rangeHeader.GetAsString())
        If (success <> 1) Then
            Debug.Print "Could not set Range."
            Exit Sub
        End If

        success = rest.SendReqNoBody("GET","/-/vaults/{vault}/jobs/{job}/output")
        If (success <> 1) Then
            Debug.Print "Could not send range request. Rerun to resume."
            Exit Sub
        End If

        Dim httpStatus As Long
        httpStatus = rest.ReadResponseHeader()
        If (httpStatus <> 206) Then
            Debug.Print "Expected HTTP 206 for range download. Job may have expired; no new retrieval was started."
            Exit Sub
        End If

        Dim responseRange As String
        responseRange = rest.ResponseHdrByName("Content-Range")
        If ((rest.LastMethodSuccess <> 1) Or (responseRange <> contentRange.GetAsString())) Then
            Debug.Print "Unexpected Content-Range; refusing download."
            Exit Sub
        End If

        Dim responseLength As String
        responseLength = rest.ResponseHdrByName("Content-Length")
        If ((rest.LastMethodSuccess <> 1) Or (responseLength <> byteCount.GetAsString())) Then
            Debug.Print "Unexpected Content-Length; refusing download."
            Exit Sub
        End If

        Dim responseHash As String
        responseHash = rest.ResponseHdrByName("x-amz-sha256-tree-hash")
        If ((rest.LastMethodSuccess <> 1) Or (responseHash = "")) Then
            Debug.Print "Missing range tree hash. Require a tree-hash-aligned retrieval and download range."
            Exit Sub
        End If

        Dim output As New ChilkatStream
        output.SinkFile = temporaryPath
        success = rest.ReadRespBodyStream(output,1)
        If (success <> 1) Then
            Debug.Print "Download interrupted; rerun to resume. Temporary bytes are not trusted."
            Exit Sub
        End If

        Dim actualSize As String
        actualSize = files.FileSizeStr(temporaryPath)
        If ((files.LastMethodSuccess <> 1) Or (actualSize <> byteCount.GetAsString())) Then
            Debug.Print "Downloaded size mismatch."
            Exit Sub
        End If

        Dim actualHash As String
        actualHash = crypt.HashFileENC(temporaryPath)
        If ((crypt.LastMethodSuccess <> 1) Or (actualHash <> responseHash)) Then
            Debug.Print "Downloaded tree hash mismatch."
            Exit Sub
        End If

        success = receipt.UpdateString("range",rangeKey)
        If (success <> 1) Then
            Debug.Print "Could not set range."
            Exit Sub
        End If

        success = receipt.UpdateString("treeHash",actualHash)
        If (success <> 1) Then
            Debug.Print "Could not set treeHash."
            Exit Sub
        End If

        success = receipt.WriteFile(receiptPath)
        If (success <> 1) Then
            Debug.Print "Could not save chunk checksum; temporary bytes remain uncommitted."
            Exit Sub
        End If

        success = files.FileRename(temporaryPath,chunkPath)
        If (success <> 1) Then
            Debug.Print "Could not commit verified chunk."
            Exit Sub
        End If

        Debug.Print "Downloaded verified chunk: " & chunkIndex
    End If

    byteHigh = endHigh
    byteLow = endLow + 1
    If (byteLow = 1000000000) Then
        byteLow = 0
        byteHigh = byteHigh + 1
    End If

    chunkIndex = chunkIndex + 1
Loop
'  Full-archive size plus hash protects against a partial retrieval job too.
'  Assemble from verified chunks; interrupted assembly is rebuilt on rerun.
success = path.SetString(cacheDir)
success = path.Append("/assembled.part")
Dim assembledPath As String
assembledPath = path.GetAsString()
Dim assembled As New CkFileAccess
success = assembled.OpenForWrite(assembledPath)
If (success <> 1) Then
    Debug.Print "Could not open assembly file."
    Exit Sub
End If

Dim data As New ChilkatBinData
chunkIndex = 0
Do While (chunkIndex < chunkCount)
    success = path.SetString(cacheDir)
    success = path.Append("/chunk-")
    success = path.AppendInt(chunkIndex)
    success = data.Clear()
    success = data.LoadFile(path.GetAsString())
    If (success = 1) Then
        success = assembled.FileWriteBd(data,0,0)
    End If

    If (success <> 1) Then
        assembled.FileClose 
        Debug.Print "Assembly failed. Verified chunks are retained for resume."
        Exit Sub
    End If

    chunkIndex = chunkIndex + 1
Loop
assembled.FileClose 
Dim assembledSize As String
assembledSize = files.FileSizeStr(assembledPath)
Dim assembledHash As String
assembledHash = crypt.HashFileENC(assembledPath)
If ((crypt.LastMethodSuccess <> 1) Or (assembledSize <> expectedSize) Or (assembledHash <> expectedHash)) Then
    Debug.Print "Assembled archive failed verification; final output was not created."
    Exit Sub
End If

success = files.FileRename(assembledPath,finalPath)
If (success <> 1) Then
    Debug.Print "Verified assembly could not be renamed; keep the cache."
    Exit Sub
End If

Debug.Print "Archive downloaded and verified. Retained chunks can now be removed manually."