All Products
Search
Document Center

Object Storage Service:Use ossutil to perform resumable file transfer

Last Updated:Aug 12, 2024

Unreliable network connections may interrupt file uploads or downloads and thereby cause much inconvenience. ossutil provides resumable transfer that you can use to resume interrupted data transfers and ensure complete and efficient uploads and downloads. This topic describes how to maintain file transfer efficiency over unstable network connections by using resumable transfer.

Scenarios

ossutil may exit uploads or downloads when network connections are unstable or lost. To prevent redundant uploads or downloads of the same data pieces and maintain upload and download efficiency, you can use the resumable transfer feature of ossutil.

Note

By default, resumable transfer is disabled.

Prerequisites

Resumable uploads

Large files are uploaded in parts. In a resumable upload, upload information such as the object name, size, and upload ID is stored in a checkpoint file with the .ucp extension in the specified directory. When the upload is resumed from an interruption, ossutil reads the upload ID from the checkpoint file, uses the upload ID to query uploaded parts, and uploads only remaining parts.

Resumable downloads

Large files are downloaded in parts. In a resumable download, the download information is stored in a checkpoint file in the specified directory. When the download is resumed from an interruption, ossutil reads the upload information from the checkpoint file and downloads only parts that have not been downloaded.

Parameters

Parameter

Description

--checkpoint-dir

The directory that stores the checkpoint file.

Examples

Upload one single file

The following sample cp command uploads the upload.rar file to a bucket named "bucket" by using resumable upload. ossutil creates a .ucp checkpoint file in the your-checkpoint-dir directory to store upload progress information. If the upload is interrupted due to reasons such as lost connections or disk read/write exceptions, you can run the same command to resume the upload.

ossutil cp upload.rar oss://bucket --checkpoint-dir D:\\your-checkpoint-dir\

Upload multiple files at a time

The following sample cp command uploads multiple files from a local directory named "local_directory" to a bucket named "bucket". In the command, the -u option specifies that the upload includes only files that are last modified later than the destination objects, and the -r option specifies the command is performed on all objects in the directory and its all subdirectories. ossutil creates a .ucp checkpoint file in the your-checkpoint-dir directory to store upload progress information. If the upload is interrupted due to reasons such as lost connections or disk read/write exceptions, you can run the same command to resume the upload.

 ossutil cp -u -r local_directory oss://bucket --checkpoint-dir D:\\your-checkpoint-dir\