← 返回命令列表

Linux command

az-disk 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Create a managed disk with a specific size

az disk create --name [MyDisk] --resource-group [MyResourceGroup] --size-gb [128]

Create a disk from a snapshot

az disk create --name [MyDisk] --resource-group [MyResourceGroup] --source [snapshot_id]

Create a Premium SSD disk

az disk create --name [MyDisk] --resource-group [MyResourceGroup] --size-gb [128] --sku Premium_LRS

List all managed disks in a resource group

az disk list --resource-group [MyResourceGroup]

Show details of a managed disk

az disk show --name [MyDisk] --resource-group [MyResourceGroup]

Update disk size

az disk update --name [MyDisk] --resource-group [MyResourceGroup] --size-gb [256]

Grant read access to a managed disk for export

az disk grant-access --name [MyDisk] --resource-group [MyResourceGroup] --duration-in-seconds [3600] --access-level Read

Revoke access to a managed disk

az disk revoke-access --name [MyDisk] --resource-group [MyResourceGroup]

Delete a managed disk

az disk delete --name [MyDisk] --resource-group [MyResourceGroup] --yes

说明

az disk manages Azure managed disks. Managed disks are block-level storage volumes managed by Azure and used with Azure Virtual Machines. They simplify disk management by handling storage account management automatically. Supported storage types include Standard HDD (Standard_LRS), Standard SSD (StandardSSD_LRS), Premium SSD (Premium_LRS), Premium SSD v2 (PremiumV2_LRS), and Ultra Disk (UltraSSD_LRS). Zone-redundant options (Premium_ZRS, StandardSSD_ZRS) provide cross-zone replication.

参数

--name -n
The name of the managed disk.
--resource-group -g
Name of resource group.
--size-gb -z
Size in GB of the managed disk.
--source
Source disk, snapshot, or URI to create the disk from.
--sku
Storage type: Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, PremiumV2_LRS, Premium_ZRS, StandardSSD_ZRS.
--location -l
Location of the disk.
--zone
Availability zone to create the disk in.
--encryption-type
Encryption type: EncryptionAtRestWithPlatformKey (default), EncryptionAtRestWithCustomerKey.
--access-level
Access level for grant-access: Read or Write.
--duration-in-seconds
Time in seconds for which the SAS access URI is valid.

FAQ

What is the az-disk command used for?

az disk manages Azure managed disks. Managed disks are block-level storage volumes managed by Azure and used with Azure Virtual Machines. They simplify disk management by handling storage account management automatically. Supported storage types include Standard HDD (Standard_LRS), Standard SSD (StandardSSD_LRS), Premium SSD (Premium_LRS), Premium SSD v2 (PremiumV2_LRS), and Ultra Disk (UltraSSD_LRS). Zone-redundant options (Premium_ZRS, StandardSSD_ZRS) provide cross-zone replication.

How do I run a basic az-disk example?

Run `az disk create --name [MyDisk] --resource-group [MyResourceGroup] --size-gb [128]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --name -n do in az-disk?

The name of the managed disk.