本文介绍如何使用 Azure 门户、Azure PowerShell 和 Azure CLI 调整 Azure 文件共享的大小、成本和性能特征。 对于使用 Microsoft.Storage 资源提供程序的经典文件共享,其过程与使用 Microsoft.FileShares(预览版)创建的文件共享不同。
适用于
| 管理模型 |
计费模式 |
媒体层 |
冗余 |
SMB |
NFS |
| Microsoft.FileShares |
预配 v2 |
SSD(高级) |
本地 (LRS) |
|
|
| Microsoft.FileShares |
预配 v2 |
SSD(高级) |
区域 (ZRS) |
|
|
| Microsoft.Storage |
预配 v2 |
SSD(高级) |
本地 (LRS) |
|
|
| Microsoft.Storage |
预配 v2 |
SSD(高级) |
区域 (ZRS) |
|
|
| Microsoft.Storage |
预配 v2 |
HDD(标准) |
本地 (LRS) |
|
|
| Microsoft.Storage |
预配 v2 |
HDD(标准) |
区域 (ZRS) |
|
|
| Microsoft.Storage |
预配 v2 |
HDD(标准) |
异地 (GRS) |
|
|
| Microsoft.Storage |
预配 v2 |
HDD(标准) |
GeoZone (GZRS) |
|
|
| Microsoft.Storage |
预配版本 v1 |
SSD(高级) |
本地 (LRS) |
|
|
| Microsoft.Storage |
预配版本 v1 |
SSD(高级) |
区域 (ZRS) |
|
|
| Microsoft.Storage |
即用即付 |
HDD(标准) |
本地 (LRS) |
|
|
| Microsoft.Storage |
即用即付 |
HDD(标准) |
区域 (ZRS) |
|
|
| Microsoft.Storage |
即用即付 |
HDD(标准) |
异地 (GRS) |
|
|
| Microsoft.Storage |
即用即付 |
HDD(标准) |
GeoZone (GZRS) |
|
|
创建文件共享后,可能需要调整共享的预配(预配模型)或访问层(即用即付模型)。 以下部分介绍如何调整共享的相关属性。
创建预配 v2 文件共享后,可以更改文件共享的一个或全部三个预配数量。 预配的存储、IOPS 和吞吐量可以根据需要动态纵向扩展或缩减。 但是,自上次增加数量以来,只能在 24 小时后减少预配数量。 存储量、IOPS 和吞吐量更改会在预配更改后的几分钟内生效。
按照以下说明更新文件共享的预配。
转到存储帐户。 在服务菜单中的“数据存储”下,选择“文件共享”。
在文件共享列表中,选择要更改其预配的文件共享。
在文件共享概述中,选择“更改大小和性能”。
“大小和性能”弹出对话框包含以下选项:
选择“保存”以保存预配更改。 存储量、IOPS 和吞吐量更改会在预配更改后的几分钟内生效。
可以使用 Update-AzRmStorageShare cmdlet 修改预配 v2 文件共享。 请记得将变量 $resourceGroupName、$storageAccountName、$shareName、$provisionedMibps、$provisionedIops 和 $provisionedStorageGib 的值替换为文件共享所需的值。
# The path to the file share resource to be modified.
$resourceGroupName = "<my-resource-group>"
$storageAccountName = "<my-storage-account-name>"
$shareName = "<name-of-the-file-share>"
# The provisioning desired on the file share. Delete the parameters if no
# change is desired.
$provisionedStorageGib = 10240
$provisionedIops = 10000
$provisionedThroughputMibPerSec = 2048
# Update the file share provisioning.
Update-AzRmStorageShare `
-ResourceGroupName $resourceGroupName `
-AccountName $storageAccountName `
-ShareName $shareName `
-QuotaGiB $provisionedStorageGib `
-ProvisionedIops $provisionedIops `
-ProvisionedBandwidthMibps $provisionedThroughputMibPerSec
$f = Get-AzRmStorageShare -ResourceGroupName $resourceGroupName -AccountName $storageAccountName -ShareName $shareName
$f | fl
可以使用 az storage share-rm update 命令修改预配 v2 文件共享。 请记得将变量 resourceGroupName、storageAccountName、fileShareName、provisionedStorageGib、provisionedIops 和 provisionedThroughputMibPerSec 的值替换为文件共享所需的值。
# The path to the file share resource to be modified.
resourceGroupName="<resource-group>"
storageAccountName="<storage-account>"
fileShareName="<file-share>"
# The provisioning desired on the file share. Delete the parameters if no
# change is desired.
provisionedStorageGib=10240
provisionedIops=10000
provisionedThroughputMibPerSec=2048
# Update the file share provisioning.
az storage share-rm update \
--resource-group $resourceGroupName \
--name $shareName \
--storage-account $storageAccountName \
--quota $provisionedStorageGib \
--provisioned-iops $provisionedIops \
--provisioned-bandwidth-mibps $provisionedThroughputMibPerSec
创建预配 v1 文件共享后,可以更改文件共享的预配存储大小。 更改共享的预配存储也会更改预配 IOPS 和预配吞吐量。 只能在上一次存储扩容操作完成 24 小时后,才可以减少已预配的存储。 存储量、IOPS 和吞吐量更改会在预配更改后的几分钟内生效。 有关详细信息,请参阅预配 v1 预配详细信息。
按照以下说明更新文件共享的预配。
转到存储帐户。 在服务菜单中的“数据存储”下,选择“文件共享”。
在文件共享列表中,选择要更改其预配的文件共享。
在文件共享概述中,选择“更改大小和性能”。
“大小和性能”弹出对话框只有一个选项,即“预配置存储 (GiB)”。 如果需要的 IOPS 或吞吐量超出了给定的预配置存储量,则可以增加预配置存储容量以获取额外的 IOPS 和吞吐量。
选择“保存”以保存预配更改。 存储量、IOPS 和吞吐量更改会在预配更改后的几分钟内生效。
注释
如果需要,可以使用 PowerShell 和 CLI 来启用/禁用付费突发。 付费突发是预配 v1 计费模型的一项高级功能。 在启用付费突发之前,请查阅预配 v1 付费突发。
可以使用 Update-AzRmStorageShare cmdlet 修改预配 v1 文件共享。 请记得将变量 $resourceGroupName、$storageAccountName 和 $fileShareName 的值替换为文件共享所需的值。 将 $provisionedStorageGib、$paidBurstingEnabled、$paidBurstingMaxIops 和 $paidBurstingMaxThroughputMibPerSec 设置为非空 ($null) 值以在文件共享上设置。 付费突发是预配 v1 模型的一项高级功能。 在启用之前,请查阅预配 v1 付费突发。
# The path to the file share resource to be modified.
$resourceGroupName = "<resource-group>"
$storageAccountName = "<storage-account>"
$fileShareName = "<file-share>"
# The provisioning desired on the file share. Set to $null to keep at the
# current level of provisioning.
$provisionedStorageGib = 10240
# Paid bursting settings.
$paidBurstingEnabled = $null # Set to $true or $false.
$paidBurstingMaxIops = $null # Set to an integer value.
$paidBurstingMaxThroughputMibPerSec = $null # Set to an integer value.
# Configure parameter object for splatting.
$params = @{
ResourceGroupName = $resourceGroupName;
StorageAccountName = $storageAccountName;
Name = $fileShareName;
}
if ($null -ne $provisionedStorageGib) {
$params += @{ QuotaGiB = $provisionedStorageGib }
}
if ($null -ne $paidBurstingEnabled) {
$params += @{ PaidBurstingEnabled = $paidBurstingEnabled }
}
if ($null -ne $paidBurstingMaxIops) {
$params += @{ PaidBurstingMaxIops = $paidBurstingMaxIops }
}
if ($null -ne $paidBurstingMaxThroughputMibPerSec) {
$params += @{
PaidBurstingMaxBandwidthMibps = $paidBurstingMaxThroughputMibPerSec
}
}
# Update the file share provisioning.
Update-AzRmStorageShare @params
可以使用 az storage share-rm update 命令修改预配 v1 文件共享。 请记得将变量 resourceGroupName、storageAccountName、fileShareName 和 provisionedStorageGib 的值替换为文件共享所需的值。
# The path to the file share resource to be modified.
resourceGroupName="<resource-group>"
storageAccountName="<storage-account>"
fileShareName="<file-share>"
# The provisioning desired on the file share.
provisionedStorageGib=10240
# Update the file share provisioning.
az storage share-rm update \
--resource-group $resourceGroupName \
--storage-account $storageAccountName \
--name $fileShareName \
--quota $provisionedStorageGib
若要切换付费突发,请使用 --paid-bursting-enabled 参数。 付费突发是预配 v1 模型的一项高级功能。 在启用之前,请查阅预配 v1 付费突发。 可以选择使用 --paid-bursting-max-iops 和 --paid-bursting-max-bandwidth-mibps 标志来设置允许的付费突发上限,以实现成本控制目的。 请记得将变量 resourceGroupName、storageAccountName 和 fileShareName 的值替换为文件共享所需的值。
resourceGroupName="<resource-group>"
storageAccountName="<storage-account>"
fileShareName="<file-share>"
az storage share-rm update \
--resource-group $resourceGroupName \
--storage-account $storageAccountName \
--name $fileShareName \
--paid-bursting-enabled true
创建即用即付文件共享后,可能需要更改两个属性:
访问层:文件共享的访问层决定了存储与 IOPS/吞吐量成本(以交易的形式)的比率。 有三个访问层:事务优化层、热层和冷层。 更改 Azure 文件共享的层需要将其迁移到新访问层,这会产生交易成本。 有关详细信息,请参阅在访问层之间切换。
配额:配额是对文件共享大小的限制。 配额属性在预配 v2 和预配 v1 模型中用于表示“预配置的存储容量”,但是在即用即付模型中,配额对账单没有直接影响。 可能需要修改此设置的两个主要原因是,如果使用配额来限制文件共享的增长,需要修改此设置以控制即用即付模式下使用的存储/交易成本,或者如果存储帐户是在引入大文件共享功能之前创建的,此设置允许文件共享超过之前 5 TiB 的限制。 即用即付文件共享的最大文件共享大小为 100 TiB。
按照以下说明使用 Azure 门户更新文件共享的访问层。
转到存储帐户。 在服务菜单中的“数据存储”下,选择“文件共享”。
在文件共享列表中,选择要更改访问层的文件共享。
在文件共享概述中,选择“更改层”。
从提供的下拉列表中选择所需的访问层。
选择“应用”以保存访问层更改。
按照以下说明更新文件共享的配额。
转到存储帐户。 在服务菜单中的“数据存储”下,选择“文件共享”。
在文件共享列表中,选择要更改配额的文件共享。
在文件共享概述中,选择“编辑配额”。
在“编辑配额”弹出窗口中,输入所需的共享大小上限或选择“设置为最大值”。 将共享设置为最大大小不会产生任何成本。
选择“确定”,保存配额更改。 新配额会在几分钟内生效。
可以使用 Update-AzRmStorageShare cmdlet 修改即用即付文件共享的访问层和配额设置。 请记得将变量 $resourceGroupName、$storageAccountName、$fileShareName、$accessTier 和 $quotaGib 的值替换为文件共享所需的值。
# The path to the file share resource to be modified.
$resourceGroupName = "<resource-group>"
$storageAccountName = "<storage-account>"
$fileShareName = "<file-share>"
# The settings to be changed on the file share. Set to $null to skip setting.
$accessTier = "Cool"
$quotaGib = $null
# Construct a parameters hash table for cmdlet splatting.
$updateParams = @{
ResourceGroupName = $resourceGroupName
StorageAccountName = $storageAccountName
Name = $fileShareName
}
if ($null -ne $accessTier) { $updateParams += @{ AccessTier = $accessTier } }
if ($null -ne $quotaGib) { $updateParams += @{ QuotaGiB = $quotaGib } }
# Update the file share
Update-AzRmStorageShare @updateParams
可以使用 az storage share-rm update 命令修改即用即付文件共享的访问层和配额设置。 请记得将变量 resourceGroupName、storageAccountName、fileShareName、accessTier 和 quotaGib 的值替换为文件共享所需的值。
# The path to the file share resource to be modified.
resourceGroupName="<resource-group>"
storageAccountName="<storage-account>"
fileShareName="<file-share>"
# The settings to be changed on the file share. Set to the empty string to skip
# setting.
accessTier="Cool"
quotaGib=""
command="az storage share-rm update --resource-group $resourceGroupName"
command="$command --storage-account $storageAccountName --name $fileShareName"
if [ ! -z "${accessTier}" ]; then
command="$command --access-tier $accessTier"
fi
if [ ! -z "${quotaGib}" ]; then
command="$command --quota $quotaGib"
fi
# Update file share (command is in variable)
$command
注释
Microsoft.FileShares 的文件共享目前为预览版。 可以使用 Azure 门户,也可以使用通用 PowerShell 或 Azure CLI 命令来处理文件共享。 如果要尝试 Microsoft.FileShares 资源提供程序的 CLI 专用包,请填写此 调查。
按照以下说明使用 Azure 门户更改文件共享 (Microsoft.FileShares) 的大小和性能。 预配的存储、IOPS 和吞吐量可以根据需要动态纵向扩展或缩减。 但是,自上次增加数量以来,只能在 24 小时后减少预配数量。 存储量、IOPS 和吞吐量更改会在预配更改后的几分钟内生效。
选择要修改的文件共享。
从上下文菜单中,选择“设置”。
选择“大小 + 性能”。
“大小和性能”弹出包含以下选项:
预配容量 (GiB):针对共享预配的存储量。
预配的 IOPS 和吞吐量:单选按钮组,你可在“推荐配置”和“手动指定 IOPS 和吞吐量”之间进行选择。 如果共享达到所配置存储量的建议 IOPS 和吞吐量级别,请选择“建议配置”;否则,请选择“手动指定 IOPS 和吞吐量”。 可以在这两个选项之间切换以更改共享预配。
IOPS:如果选择“手动指定 IOPS 和吞吐量”,则可在此文本框更改针对此文件共享配置的 IOPS 量。
吞吐量(MiB/秒):如果选择“手动指定 IOPS 和吞吐量”,则可在此文本框更改要针对此文件共享配置的吞吐量。
选择“保存”。 存储量、IOPS 和吞吐量更改会在预配更改后的几分钟内生效。
若要使用 PowerShell 更改文件共享(Microsoft.FileShares)的大小和性能,请使用以下命令。
$Resource = Get-AzResource -ResourceType "Microsoft.FileShares/fileShares" `
-ResourceGroupName "<your-resource-group-name>" `
-ResourceName "<your-file-share-name>"
# You may update file share, provisioned capacity, IOPS, throughput, mount name, and nfsProtocolProperties here.
# For more info, refer to the property example for update section.
$Resource.Properties.provisionedStorageGiB = <intended capacity>
$Resource | Set-AzResource -Force
更新的属性示例:
-Properties @{
provisionedStorageGiB = 36
ProvisionedIoPerSec = 5005
ProvisionedThroughputMiBPerSec = 1003
mountName = "<intened-mount-name>"
nfsProtocolProperties = @{
rootSquash = "AllSquash"
}
}
要检查文件共享信息:
$Resource = Get-AzResource -ResourceType "Microsoft.FileShares/fileShares" `
-ResourceGroupName "<your-resource-group-name>" `
-ResourceName "<your-file-share-name>"
$Resource.properties
若要使用 Azure CLI 更改文件共享(Microsoft.FileShares)的大小和性能,请使用以下命令。
az resource update \
--resource-type "Microsoft.FileShares/fileShares" \
--name <your-file-share-name> \
--resource-group <your-resource-group-name> \
--set properties.provisionedStorageGiB=<intended capacity> \
properties.ProvisionedIoPerSec=<intended IOPS> \
properties.ProvisionedThroughputMiBPerSec=<intended througphput> \
properties.nfsProtocolProperties.rootSquash="AllSquash"
要检查文件共享信息,请遵循以下步骤:
az resource show \
--resource-type "Microsoft.FileShares/fileShares" \
--name <your-file-share-name> \
--resource-group <your-resource-group-name>
删除经典文件共享
建议删除未使用的或过时的文件共享,具体视工作流而定。 可以在保留期内恢复启用软删除的存储帐户中的文件共享。
按照以下说明使用 Azure 门户删除经典文件共享。
转到存储帐户。 在服务菜单中的“数据存储”下,选择“文件共享”。
在文件共享列表中,选择要删除的文件共享的“...”。
从上下文菜单中选择“删除共享”。
“删除”弹出窗口包含有关删除文件共享的原因的调查。 可以跳过这一步,但我们很感谢你对 Azure 文件存储提出的反馈,当某些功能无法正常运行时更是如此。
输入文件共享名称以确认删除,然后选择“删除”。
可以使用 Remove-AzRmStorageShare cmdlet 删除文件共享。 请记得将变量 $resourceGroupName、$storageAccountName 和 $fileShareName 的值替换为文件共享所需的值。
# The path to the file share resource to be deleted.
$resourceGroupName = "<resource-group>"
$storageAccountName = "<storage-account>"
$fileShareName = "<file-share>"
# Remove the file share
Remove-AzRmStorageShare `
-ResourceGroupName $resourceGroupName `
-StorageAccountName $storageAccountName `
-Name $fileShareName
可以使用 az storage share-rm delete 命令删除文件共享。 请记得将变量 resourceGroupName、storageAccountName 和 fileShareName 的值替换为文件共享所需的值。
resourceGroupName="<resource-group>"
storageAccountName="<storage-account>"
fileShareName="<file-share>"
az storage share-rm delete \
--resource-group $resourceGroupName \
--storage-account $storageAccountName \
--name $fileShareName
删除文件共享 (Microsoft.FileShares)
注释
Microsoft.FileShares 的文件共享目前为预览版。 可以使用 Azure 门户,也可以使用通用 PowerShell 或 Azure CLI 命令来处理文件共享。 如果要尝试 Microsoft.FileShares 资源提供程序的 CLI 专用包,请填写此 调查。
若要使用 Azure 门户删除文件共享(Microsoft.FileShares),请执行以下步骤。
转到文件共享。
从上下文菜单中选择“删除”。
“删除”弹出窗口包含有关删除文件共享的原因的调查。 可以跳过这一步,但我们很感谢你对 Azure 文件存储提出的反馈,当某些功能无法正常运行时更是如此。
输入文件共享名称以确认删除,然后选择“删除”。
若要使用 PowerShell 删除文件共享(Microsoft.FileShares),请运行以下命令。
Remove-AzResource -ResourceType "Microsoft.FileShares/fileShares" `
-ResourceName "<your-file-share-name>" `
-ResourceGroupName "<your-resource-group-name>" `
若要使用 Azure CLI 删除文件共享(Microsoft.FileShares),请运行以下命令。
az resource delete \
--resource-type "Microsoft.FileShares/fileShares" \
--name <your-file-share-name> \
--resource-group <your-resource-group-name>
后续步骤