如果您已將新的空白磁碟連接至 VM,則必須先格式化及掛接磁碟,才能使用該磁碟。如果您已連接含有資料的磁碟,則必須先掛接磁碟才能使用。
事前準備
-
如果尚未設定,請先設定驗證機制。驗證是指驗證身分,以便存取 Google Cloud 服務和 API 的程序。如要在本機開發環境中執行程式碼或範例,您可以選取下列任一選項,向 Compute Engine 進行驗證:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
-
After installing the Google Cloud CLI, initialize it by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
- Set a default region and zone.
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
After installing the Google Cloud CLI, initialize it by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
For more information, see Authenticate for using REST in the Google Cloud authentication documentation.
-
連線至 VM
前往「VM instances」(VM 執行個體) 頁面。
按一下已連接新空白磁碟的 VM 旁邊的 RDP 按鈕。瀏覽器會開啟對於執行個體的遠端桌面協定連線。
在 Windows VM 上格式化及掛接非開機磁碟
使用 Windows 磁碟管理公用程式,即可在 Windows VM 上格式化和掛接新磁碟。
在 Windows [Start] (開始) 按鈕上按一下滑鼠右鍵,然後選取 [Disk Management] (磁碟管理)。
「磁碟管理」會提示您選取新磁碟的分區配置。選取「GPT」,然後按一下「OK」。
磁碟初始化後,請在未配置的磁碟空間上按一下滑鼠右鍵,然後選取 [New Simple Volume] (新增簡單磁碟區)。
請按照「New Simple Volume Wizard」(新增簡單磁碟區精靈) 中的操作說明,設定新的磁碟區。您可以使用任何想要的磁碟分區格式,但在此範例中請選取
NTFS
。此外,也請勾選 [Perform a quick format] (執行快速格式化),以加速執行格式化程序。或者,在「Allocation unit size」(配置單位大小) 欄位中設定叢集大小。叢集大小會限制分區的大小上限。如果您日後想要嘗試調整區域永久磁碟與此分區的大小,請記住這點。結束精靈並完成磁碟區格式化作業後,請查看連接磁碟清單中的
Status
資料欄,確認新磁碟的狀態為Healthy
。
您現在可以將檔案寫入磁碟。