本文介紹如何在Hyper-V中擴展vm硬盤而不丟失數據。 通過詳細步驟在Hyper-v虛擬機中擴展硬盤驅動器的2種方法。
適用於: Windows 10, Windows 8, Windows 7, Windows Server 2019, Windows Server 2016, Windows Server 2012 (R2), Windows Server 2008 (R2), Windows Server 2003 (R2)。
Hyper-V vm中的常見問題之一是整個虛擬磁盤已滿。 在這種情況下,您將做什麼,添加另一個更大的磁盤並從原始磁盤複製或還原? 有更快,更輕鬆的方法-直接擴展虛擬硬盤驅動器。 為此,有兩種方法。 每種方式都有其優點和缺點。 本文介紹了詳細的步驟 展開vm硬盤驅動器 在Hyper-V中。
方法1-使用PowerShell命令在Hyper-V中擴展VM硬盤
使用擴展虛擬機硬盤 PowerShell的 是最快和最簡單的方法,但是,在擴展之前,應關閉Hyper-V虛擬機並刪除與要擴展的磁盤關聯的Checkpoint。
如何使用PowerShell擴展Hyper-V虛擬機的硬盤:
- 從“快速啟動”欄或“開始”菜單中以管理員權限打開PowerShell。
- 類型 調整大小-VHD-路徑'E:\ yourown.vhdx'-SizeBytes 200gb
備註:
- E:\ yourown.vhdx 表示帶引號的虛擬磁盤的絕對路徑和名稱。
- 200gb表示將vm硬盤擴展到200GB,而不添加200GB。
方法2-使用Hyper-V Manager在線擴展VM硬盤
使用Hyper-V Manager,可以動態擴展VM硬盤驅動器 不分流 來賓虛擬機。 但是,這需要更多步驟,此外,您最好還刪除具有關聯虛擬磁盤的檢查點。
如何使用Hyper-V Manager擴展VM硬盤驅動器:
不久後,原始虛擬硬盤將得到擴展,並且其他磁盤空間將顯示為 未配置 最後。
如果你堅持 Windows 磁碟管理或 NIUBI Partition Editor 在擴展虛擬磁盤時運行,您需要單擊 刷新 按鈕以加載最新的磁盤分區參數。 在一些 Windows 版本,則需要重新打開磁碟管理。
擴展硬盤後如何擴展虛擬分區
After expanding vm hard drive, you need to add the additional 未配置空間 to system C槽 and/or other volumes. To accomplish this task, NIUBI Partition Editor 非常簡單,快速,您只需在磁盤映射上拖放即可。
下載資源 NIUBI Partition Editor 並按照視頻中的步驟操作:
備註: if there's another partition such as D: in the middle, to extend system C槽, you need to move 未配置空間 behind it first.
為此,右鍵單擊驅動器 D: 然後選擇“Resize/Move Volume”,將 中間 position 朝右側 in the pop-up window. If you want to extend the contiguous partition with 未配置空間, you can combine directly without moving. (Drag right 邊界 在彈出窗口中。