儲存空間最佳化 VM。如果 Z3 VM 附加的 Titanium SSD 超過 18 TiB,就不支援即時遷移。這些 VM 的維護行為會設為 TERMINATE 和 RESTART。如「執行個體終止後磁碟的持續性」一文所述,Compute Engine 會在維護事件期間保留 Titanium SSD 上的資料。
即時遷移程序如何運作?
如果 VM 預計要即時遷移,Compute Engine 會提供通知,讓您為這項即時遷移作業造成的服務中斷做好準備。執行即時遷移作業時, Google Cloud 會觀察到最短的中斷時間,通常遠少於 1 秒。如果 VM 未設為即時遷移,Compute Engine 會在主機維護期間終止 VM。如果 VM 設定為在主機事件期間終止,則會停止並視情況重新啟動。
當 Google Cloud 將執行中的 VM 從某部主機遷移到另一部主機時,會以客體 OS 和與其通訊的任何項目都無法察覺的方式,將 VM 的完整狀態從來源移至目的地。
要讓這作業能順暢運作,會牽涉到許多元件;我們利用下圖說明基本步驟:
即時遷移元件
該程序首先會通知您,某些 VM 需要從目前的主機中移除。通知開頭可能會顯示檔案變更,指出有新版 BIOS 可用、硬體作業排定維護時間,或是硬體即將故障而自動發出訊號。
Google Cloud的叢集管理軟體會持續監控這些事件,並根據控制資料中心的政策 (例如容量使用率和單一客戶一次可遷移的 VM 數量) 安排事件。
當 Google Cloud 選取要遷移的 VM 之後,會向客體發出遷移作業即將開始的通知。系統會在等待一段時間之後選取目標主機,並要求該主機設定全新的空白「目標」VM,以便接收遷移中的「來源」VM。系統會使用驗證功能來建立來源和目標之間的連線。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-19 (世界標準時間)。"],[[["\u003cp\u003eCompute Engine performs live migration to move a virtual machine (VM) to a new host server during maintenance events without interrupting workloads or modifying instance properties.\u003c/p\u003e\n"],["\u003cp\u003eLive migration occurs during infrastructure maintenance, security updates, system changes, and hardware failures, ensuring continuous operation of instances.\u003c/p\u003e\n"],["\u003cp\u003eVMs with Local SSD disks can be live-migrated, though large amounts of data can lead to longer periods of performance degradation or data loss.\u003c/p\u003e\n"],["\u003cp\u003eCertain VM types, such as bare metal instances, most Confidential VMs, VMs with GPUs, Cloud TPUs, and Z3 VMs, do not support live migration and instead terminate and optionally restart during host maintenance.\u003c/p\u003e\n"],["\u003cp\u003eThe live migration process involves a notification, followed by a "brownout" where VM state is transferred, a brief "blackout" when the VM pauses, and then a "target brownout" as the VM executes on the new host, with minimal disruption to the workload.\u003c/p\u003e\n"]]],[],null,["# Live migration process during maintenance events\n\n*** ** * ** ***\n\nDuring a planned maintenance event for the underlying hardware of a virtual\nmachine (VM) instance or bare\nmetal instance, the host server is unavailable. To keep an\ninstance running during a host event, Compute Engine performs a\n*live migration* of the instance to another host server in the same zone. For\nmore information about host events, see\n[About host events](/compute/docs/instances/host-maintenance-overview).\n\nLive migration lets Google Cloud perform maintenance without\ninterrupting a workload, rebooting an instance, or modifying any of the\ninstance's properties, such as IP addresses, metadata, block storage data,\napplication state, or network settings.\n\nLive migration keeps instances running during the following situations:\n\n- **Infrastructure maintenance.** Infrastructure maintenance includes host\n hardware, network and power grids in data centers, and host operating\n system (OS) and BIOS.\n\n- **Security-related updates and system configuration changes.** These include\n events such as installing security patches and changing the size of the host\n root partition for storage of the host OS image and packages.\n\n- **Hardware failures.** This includes failures in memory, CPUs, network\n interface cards, and disks. If the failure is detected before there is\n a complete server failure, then Compute Engine performs a preventative\n live migration of the instance to a new host server. If the hardware fails\n completely or otherwise prevents live migration, then the instance terminates\n and restarts automatically.\n\nCompute Engine only performs a live migration of VMs that have the\nhost maintenance policy set to migrate. For information about how to change the\nhost maintenance policy, see\n[Set VM host maintenance policy](/compute/docs/instances/host-maintenance-options).\n\nLive migration process and Local SSD disks\n------------------------------------------\n\nCompute Engine can live migrate instances with Local SSD disks\nattached (excluding Z3 instances with more than 18 TiB of attached\nTitanium SSD). Compute Engine moves the VM instances along with\ntheir Local SSD data to a new machine in advance of any planned maintenance.\n| **Caution:** Instances with a large amount of Local SSD data can experience a longer period of performance degradation or Local SSD data loss during the migration to the new host server.\n\nLimitations\n-----------\n\nLive migration is not supported for the following VM types:\n\n- **Bare metal instances** . Instances created with a [bare metal machine type](/compute/docs/instances/bare-metal-instances) don't support live migration. The maintenance behavior for these instances is set to `TERMINATE` and `RESTART`, respectively.\n- **Most Confidential VM instances** . Live migration for Confidential VM instances is only supported on N2D machine types with AMD EPYC Milan CPU platforms running AMD SEV. All other Confidential VM instances don't support live migration, and must be set to stop and optionally restart during a host maintenance event. See [Live migration](/confidential-computing/confidential-vm/docs/troubleshoot-live-migration) for more details.\n- **VMs with GPUs attached**. VM instances with GPUs attached must be set\n to stop and optionally restart. Compute Engine offers a notice\n before a VM instance with a GPU attached is stopped, depending on the GPU\n type:\n\n - For most GPUs, Compute Engine provides a 60-minute notice.\n - For GPU families running on AI Hypercomputer Cluster Director, Compute Engine provides a 10-minute notice.\n\n To learn more about these maintenance event notices, read\n [Query metadata\n server for maintenance event notices](/compute/docs/metadata/getting-live-migration-notice).\n\n To learn more about handling host maintenance with GPUs, read\n [Handling host maintenance](/compute/docs/gpus/gpu-host-maintenance)\n in the GPUs documentation.\n- **Cloud TPUs** . [Cloud TPUs](/tpu/docs/tpus) don't support live migration.\n- **Storage-optimized VMs** . Z3 VMs with more than 18 TiB of attached Titanium SSD don't support live migration. The maintenance behavior for these VMs is set to `TERMINATE` and `RESTART`.Compute Engine preserves the data on Titanium SSD during the maintenance event, as described in [Disk persistence following instance termination](/compute/docs/instances/host-maintenance-overview#disk-persistence).\n\n\u003cbr /\u003e\n\nHow does the live migration process work?\n-----------------------------------------\n\nWhen a VM is scheduled to live migrate, Compute Engine provides a\n[notification](/compute/docs/metadata/getting-live-migration-notice) so that\nyou can prepare your workloads and applications for this live migration\ndisruption. During live migration, Google Cloud observes a minimum\ndisruption time, which is typically much less than 1 second. If a VM is not\nset to live migrate, Compute Engine terminates the VM during host\nmaintenance. VMs that are set to terminate during a host event\n[stop and (optionally) restart](/compute/docs/instances/host-maintenance-overview#terminate_and_optionally_restart).\n\nWhen Google Cloud migrates a running VM from one host to another, it\nmoves the complete state of the VM from the source to the destination in a way\nthat is transparent to the guest OS and anything communicating with it.\n\nThere are many components involved in making this work seamlessly, but the\nhigh-level steps are shown in the following illustration:\n[](/static/compute/images/live-migration.svg) *Live migration components*\n\nThe process begins with a notification that a VM needs to be moved from its\ncurrent host machine. The notification might start with a file change indicating\nthat a new BIOS version is available, a hardware operation scheduling\nmaintenance, or an automatic signal from an impending hardware failure.\n\nGoogle Cloud's cluster management software constantly watches for these\nevents and schedules them based on policies that control the data centers, such\nas capacity utilization rates and the number of VMs that a single customer can\nmigrate at once.\n\nAfter a VM is selected for migration, Google Cloud provides a\nnotification to the guest that a migration is happening soon. After a waiting\nperiod, a target host is selected and the host is asked to set up a new, empty\n\"target\" VM to receive the migrating \"source\" VM. Authentication is used to\nestablish a connection between the source and the target.\n\nThere are three stages involved in the VM's migration:\n\n1. **Source brownout.** The VM is still executing on the source, while\n most state is sent from the source to the target. For example,\n Google Cloud copies all the guest memory to the target, while\n tracking the pages that have been changed on the source. The time spent in\n source brownout is a function of the size of the guest memory and the rate\n at which pages are being changed.\n\n2. **Blackout.** A very brief moment when the VM is not running anywhere, the\n source VM is paused and all the remaining state required to begin running\n the VM on the target is sent. The VM enters the blackout stage when sending\n state changes during the source brownout stage reaches a point of\n diminishing returns. An algorithm is used that balances numbers of bytes of\n memory being sent against the rate at which the guest VM is making changes.\n\n During blackout events, the system clock appears to jump forward, up to 5\n seconds. If a blackout event exceeds 5 seconds, Google Cloud stops\n and synchronizes the clock using a daemon that is included as part of the\n VM guest packages.\n3. **Target brownout.** The VM executes on the target VM. The source VM\n is present and might provide support for the target VM. For\n example, until the network fabric has caught up with the new location of the\n target VM, the source VM provides forwarding services for packets to and from\n the target VM.\n\nFinally, the migration is complete and the system deletes the source VM. You can\nsee that the migration took place in the [Cloud Logging logs](/compute/docs/instances/monitor-plan-host-maintenance-event#check-logs-for-maintenance)\nfor your VM.\n| **Note:** During live migration, VMs might experience a decrease in performance in disk, CPU, memory, and network utilization for a short period of time.\n\nLive migration of sole-tenant VMs\n---------------------------------\n\nAs your workload runs, you might want to move VMs to a different sole-tenant\nnode or node group. If you move a VM to a group of nodes, Compute Engine\ndetermines which node to place it on. For information about sole-tenancy, see\n[Sole-tenancy overview](/compute/docs/nodes/sole-tenant-nodes).\n\nTo move sole-tenant VMs to a different node or node group, you can manually\ninitiate a live migration. You can also manually initiate a live migration to\nmove a VM on a multi-tenant host into a sole-tenant node. For more information,\nsee [Manually live migrate VMs](/compute/docs/nodes/about-manual-live-migration).\n\nWhat's next\n-----------\n\n- Set [VM host maintenance policy](/compute/docs/instances/setting-vm-host-options)\n options to configure your instances to live migrate.\n\n- Learn how to [get live migration notices](/compute/docs/metadata/getting-live-migration-notice#maintenanceevents)\n so you can trigger tasks that you want to perform prior to a\n maintenance event.\n\n- Read tips for [designing a robust system](/compute/docs/tutorials/robustsystems)\n that can handle service disruptions."]]