简体   繁体   English

可以复制 Azure 存储文件共享吗?

[英]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.我们使用 Azure 文件共享作为 docker 容器的数据卷,我们希望每晚备份它们。 Is there a way of making copies of file shares using the .net SDK?有没有办法使用 .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 .请参阅此处的Copy Files部分: 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.您可以做的另一件事是使用AzCopy实用程序将整个共享复制到同一存储帐户内或跨存储帐户的另一个共享。 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.另一种选择是使用适用于 .NET 的 Azure 存储数据移动库。 This is the library that underlies AzCopy.这是作为 AzCopy 基础的库。

Take a look at the announcement here: https://azure.microsoft.com/en-us/blog/announcing-azure-storage-data-movement-library-0-2-0/看看这里的公告: https : //azure.microsoft.com/en-us/blog/annoucing-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这里还有一个有用的示例应用程序: 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如果您不熟悉 AzCopy,请参阅此处: https ://azure.microsoft.com/en-us/documentation/articles/storage-use-azcopy/#file-copy

As of Dec 2019 following command worked for me截至 2019 年 12 月,以下命令对我有用

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文档: https : //docs.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-files

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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