您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

Azure 托管磁盘简介Introduction to Azure managed disks

Azure 托管磁盘是虚拟硬盘 (VHD)。An Azure managed disk is a virtual hard disk (VHD). 可以将其视为本地服务器中的物理磁盘,但它是虚拟化的。You can think of it like a physical disk in an on-premises server but, virtualized. Azure 托管磁盘作为页 blob 存储,后者是 Azure 中的随机 IO 存储对象。Azure managed disks are stored as page blobs, which are a random IO storage object in Azure. 我们之所以将托管磁盘称为“托管”是因为,它是对页 blob、blob 容器和 Azure 存储帐户的抽象。We call a managed disk ‘managed’ because it is an abstraction over page blobs, blob containers, and Azure storage accounts. 对于托管磁盘,你所要做的就是预配磁盘,而 Azure 负责其余的工作。With managed disks, all you have to do is provision the disk, and Azure takes care of the rest.

如果选择将 Azure 托管磁盘与工作负荷配合使用,Azure 将为你创建和管理该磁盘。When you select to use Azure managed disks with your workloads, Azure creates and manages the disk for you. 可用的磁盘类型包括超级固态硬盘 (SSD)(预览版)、高级 SSD、标准 SSD 和标准硬盘驱动器 (HDD)。The available types of disks are Ultra Solid State Drives (SSD) (Preview), Premium SSD, Standard SSD, and Standard Hard Disk Drives (HDD). 有关每种磁盘类型的详细信息,请参阅选择适用于 IaaS VM 的磁盘类型For more information about each individual disk type, see Select a disk type for IaaS VMs.

托管磁盘的好处Benefits of managed disks

接下来让我们看一下使用托管磁盘可以获得的一些好处。Let's go over some of the benefits you gain by using managed disks.

高度持久和可用Highly durable and available

托管磁盘具备 99.999% 的可用性。Managed disks are designed for 99.999% availability. 托管磁盘实现这一点的方式是:提供三个包含数据的副本,确保高持久性。Managed disks achieve this by providing you with three replicas of your data, allowing for high durability. 如果其中一个或两个副本出现问题,剩下的副本能够确保数据的持久性和对故障的高耐受性。If one or even two replicas experience issues, the remaining replicas help ensure persistence of your data and high tolerance against failures. 此架构有助于 Azure 为基础结构即服务 (IaaS) 磁盘持续提供企业级的持久性,年化故障率为 0%,达到行业领先水平。This architecture has helped Azure consistently deliver enterprise-grade durability for infrastructure as a service (IaaS) disks, with an industry-leading ZERO% annualized failure rate.

简单且可缩放的 VM 部署Simple and scalable VM deployment

托管磁盘支持在每个区域中的一个订阅中创建最多 50,000 个同一类型的 VM 磁盘,这样就可以在单个订阅中创建数以万计的 VM。Using managed disks, you can create up to 50,000 VM disks of a type in a subscription per region, allowing you to create thousands of VMs in a single subscription. 通过允许使用某个市场映像在一个虚拟机规模集中创建多达 1,000 VM,此功能还可以进一步增加虚拟机规模集的可伸缩性。This feature also further increases the scalability of virtual machine scale sets by allowing you to create up to 1,000 VMs in a virtual machine scale set using a Marketplace image.

集成可用性集Integration with availability sets

托管磁盘集成可用性集,可确保可用性集中的 VM 的磁盘彼此之间完全隔离以避免单点故障。Managed disks are integrated with availability sets to ensure that the disks of VMs in an availability set are sufficiently isolated from each other to avoid a single point of failure. 磁盘自动放置于不同的存储缩放单元(模块)。Disks are automatically placed in different storage scale units (stamps). 如果某个模块因硬件或软件故障而失败,则只有其磁盘在该模块上的 VM 实例会失败。If a stamp fails due to hardware or software failure, only the VM instances with disks on those stamps fail. 例如,假定某个应用程序在 5 台 VM 上运行并且这些 VM 位于一个可用性集中。For example, let's say you have an application running on five VMs, and the VMs are in an Availability Set. 这些 VM 的磁盘不会存储在同一个模块中,因此,如果一个模块失败,该应用程序的其他实例可以继续运行。The disks for those VMs won't all be stored in the same stamp, so if one stamp goes down, the other instances of the application continue to run.

与可用性区域集成Integration with Availability Zones

托管磁盘支持可用性区域,这是一种高可用性产品/服务,可以保护应用程序免受数据中心故障的影响。Managed disks supports Availability Zones, which is a high-availability offering that protects your applications from datacenter failures. 可用性区域是 Azure 区域中独特的物理位置。Availability Zones are unique physical locations within an Azure region. 每个区域由一个或多个数据中心组成,这些数据中心配置了独立电源、冷却和网络。Each zone is made up of one or more datacenters equipped with independent power, cooling, and networking. 为确保能够进行复原,所有已启用的区域中必须至少有三个单独的区域。To ensure resiliency, there’s a minimum of three separate zones in all enabled regions. Azure 凭借可用性区域提供一流的 99.99% VM 运行时间 SLA。With Availability Zones, Azure offers industry best 99.99% VM uptime SLA.

Azure 备份支持Azure Backup support

若要防范区域灾难,可以使用 Azure 备份创建具有基于时间的备份和备份保留策略的备份作业。To protect against regional disasters, Azure Backup can be used to create a backup job with time-based backups and backup retention policies. 这样就可以随意执行简单的 VM 还原。This allows you to perform easy VM restorations at will. 目前,Azure 备份支持高达 4 TB (TiB) 的磁盘大小。Currently Azure Backup supports disk sizes up to four tebibyte (TiB) disks. 有关详细信息,请参阅为具有托管磁盘的 VM 使用 Azure 备份For more information, see Using Azure Backup for VMs with managed disks.

粒度访问控制Granular access control

可以使用 Azure 基于角色的访问控制 (RBAC) 将对托管磁盘的特定权限分配给一个或多个用户。You can use Azure role-based access control (RBAC) to assign specific permissions for a managed disk to one or more users. 托管磁盘公开了各种操作,包括读取、写入(创建/更新)、删除,以及检索磁盘的共享访问签名 (SAS) URIManaged disks expose a variety of operations, including read, write (create/update), delete, and retrieving a shared access signature (SAS) URI for the disk. 可以仅将某人员执行其工作所需的操作的访问权限授予该人员。You can grant access to only the operations a person needs to perform their job. 例如,如果不希望某人员将某个托管磁盘复制到存储帐户,则可以选择不授予对该托管磁盘的导出操作的访问权限。For example, if you don't want a person to copy a managed disk to a storage account, you can choose not to grant access to the export action for that managed disk. 类似地,如果不希望某人员使用 SAS URI 复制某个托管磁盘,则可以选择不授予对该托管磁盘的该权限。Similarly, if you don't want a person to use an SAS URI to copy a managed disk, you can choose not to grant that permission to the managed disk.

磁盘角色Disk roles

在 Azure 中有三个主要磁盘角色:数据磁盘、OS 磁盘和临时磁盘。There are three main disk roles in Azure: the data disk, the OS disk, and the temporary disk. 这些角色将映射到附加到虚拟机的磁盘。These roles map to disks that are attached to your virtual machine.


数据磁盘Data disk

数据磁盘是附加到虚拟机的托管磁盘,用于存储应用程序数据或其他需要保留的数据。A data disk is a managed disk that's attached to a virtual machine to store application data, or other data you need to keep. 数据磁盘注册为 SCSI 驱动器并且带有所选择的字母标记。Data disks are registered as SCSI drives and are labeled with a letter that you choose. 每个数据磁盘的最大容量为 32,767 gibibytes (GiB)。Each data disk has a maximum capacity of 32,767 gibibytes (GiB). 虚拟机的大小决定了可附加的磁盘数目,以及可用来托管磁盘的存储类型。The size of the virtual machine determines how many data disks you can attach to it and the type of storage you can use to host the disks.

操作系统磁盘OS disk

每个虚拟机都附加了一个操作系统磁盘。Every virtual machine has one attached operating system disk. 该 OS 磁盘有一个预先安装的 OS,是在创建 VM 时选择的。That OS disk has a pre-installed OS, which was selected when the VM was created.

此磁盘最大容量为 2,048 GiB。This disk has a maximum capacity of 2,048 GiB.

临时磁盘Temporary disk

每个 VM 包含一个不是托管磁盘的临时磁盘。Every VM contains a temporary disk, which is not a managed disk. 临时磁盘为应用程序和进程提供短期存储存储空间,仅用于存储页面或交换文件等数据。The temporary disk provides short-term storage for applications and processes and is intended to only store data such as page or swap files. 维护事件期间或重新部署 VM 时,临时磁盘上的数据可能会丢失。Data on the temporary disk may be lost during a maintenance event event or when you redeploy a VM. 在 Azure Linux VM 上,临时磁盘默认为 /dev/sdb,而在 Windows VM 上,临时磁盘默认为 E:。On Azure Linux VMs, the temporary disk is /dev/sdb by default and on Windows VMs the temporary disk is E: by default. 在 VM 成功标准重启期间,临时磁盘上的数据将保留。During a successful standard reboot of the VM, the data on the temporary disk will persist.

托管磁盘快照Managed disk snapshots

托管磁盘快照是托管磁盘的只读完整副本,默认情况下它作为标准托管磁盘进行存储。A managed disk snapshot is a read-only full copy of a managed disk that is stored as a standard managed disk by default. 使用快照,可以在任意时间点备份托管磁盘。With snapshots, you can back up your managed disks at any point in time. 这些快照独立于源磁盘而存在,并可用来创建新的托管磁盘。These snapshots exist independent of the source disk and can be used to create new managed disks. 基于已使用大小对这些快照进行计费。They are billed based on the used size. 例如,如果创建预配容量为 64 GiB 且实际使用数据大小为 10 GiB 的托管磁盘的快照,则仅针对已用数据大小 10 GiB 对该快照计费。For example, if you create a snapshot of a managed disk with provisioned capacity of 64 GiB and actual used data size of 10 GiB, that snapshot is billed only for the used data size of 10 GiB.

若要了解有关如何使用托管磁盘创建快照的详细信息,请查看下列资源:To learn more about how to create snapshots with managed disks, see the following resources:


托管磁盘还支持创建托管自定义映像。Managed disks also support creating a managed custom image. 可以从存储帐户中的自定义 VHD 创建映像或者直接从通用化 (sysprepped) VM 创建映像。You can create an image from your custom VHD in a storage account or directly from a generalized (sysprepped) VM. 此过程捕获单个映像。This process captures a single image. 该映像包含与 VM 关联的所有托管磁盘,包括 OS 磁盘和数据磁盘。This image contains all managed disks associated with a VM, including both the OS and data disks. 该托管自定义映像支持使用自定义映像创建数百台 VM,且不需要复制或管理任何存储帐户。This managed custom image enables creating hundreds of VMs using your custom image without the need to copy or manage any storage accounts.

有关创建映像的信息,请查看以下文章:For information on creating images, see the following articles:

映像与快照Images versus snapshots

了解映像与快照之间的区别很重要。It's important to understand the difference between images and snapshots. 使用托管磁盘,可以创建已解除分配的通用 VM 的映像。With managed disks, you can take an image of a generalized VM that has been deallocated. 此映像包括附加到该 VM 的所有磁盘。This image includes all of the disks attached to the VM. 可以使用此映像创建 VM,它包括所有磁盘。You can use this image to create a VM, and it includes all of the disks.

快照是磁盘在创建快照那一刻的副本。A snapshot is a copy of a disk at the point in time the snapshot is taken. 它仅应用于一个磁盘。It applies only to one disk. 如果 VM 有一个磁盘(OS 磁盘),则可以为其创建快照或映像,并且可以通过该快照或映像创建 VM。If you have a VM that has one disk (the OS disk), you can take a snapshot or an image of it and create a VM from either the snapshot or the image.

除了所包含的磁盘,快照无法感知任何其他磁盘。A snapshot doesn't have awareness of any disk except the one it contains. 因此,如果在要求对多个磁盘进行协调的方案(例如条带化方案)中使用,则会出现问题。This makes it problematic to use in scenarios that require the coordination of multiple disks, such as striping. 快照彼此之间将需要相互协调,而目前并不支持此功能。Snapshots would need to be able to coordinate with each other and this is currently not supported.

后续步骤Next steps

在有关磁盘类型的文章中,详细了解 Azure 提供的各个磁盘类型,以及哪个类型符合自己的需求。Learn more about the individual disk types Azure offers and which type is a good fit for your needs in our article on disk types.