简体   繁体   中英

Can Azure Storage File Shares be copied?

We're using Azure file shares as data volumes for docker containers, and we'd like to back them up nightly. Is there a way of making copies of file shares using the .net SDK?

If you're looking for a single-operation share copy, then it is not available.

What you would need to do is list all files and directories in a share and then copy them one by one. Please see Copy Files section here: https://azure.microsoft.com/en-in/documentation/articles/storage-dotnet-how-to-use-files/#develop-with-file-storage .

Another thing you could do is use AzCopy utility to copy an entire share to another within same storage account or across storage accounts. Here's the command you would use:

AzCopy /Source:https://myaccount1.file.core.windows.net/myfileshare1/ /Dest:https://myaccount2.file.core.windows.net/myfileshare2/ /SourceKey:key1 /DestKey:key2 /S

Another option is to use the Azure Storage Data Movement Library for .NET. This is the library that underlies AzCopy.

Take a look at the announcement here: https://azure.microsoft.com/en-us/blog/announcing-azure-storage-data-movement-library-0-2-0/

There's also a helpful sample application here: https://github.com/Azure/azure-storage-net-data-movement/tree/master/samples/DataMovementSamples

If you're not familiar with AzCopy, see here: https://azure.microsoft.com/en-us/documentation/articles/storage-use-azcopy/#file-copy

As of Dec 2019 following command worked for me

azcopy copy 'https://<source-storage-account-name>.file.core.windows.net/<file-share-name>/<file-path>?<SAS-token>' 'https://<destination-storage-account-name>.file.core.windows.net/<file-share-name>/<file-path>?<SAS-token>'

Documentation: https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-files

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM