【GCP常見問題】調整永久磁碟的大小

情境

在無法 SSH 進入 Compute Engine 的情況下,如何進行磁碟擴增?


前篇文章有介紹一些當遇到無法 SSH 時的解決方式,其中有提到 VM 的磁碟滿載可能是導致此狀況的原因。當這樣的情況發生時,查看 Serial port 1 的 Logs 會發現 OSError: [Errno 28] No space left on device 的訊息。

因此,本篇文章要紀錄如何在無法 SSH 連線進入機器的情況下,進行磁碟擴增。

操作

步驟

1. 把 VM 關機,並將這台VM的開機磁碟卸載

test

卸載磁碟

2. 開啟一台新的 VM,將剛剛卸載的開機磁碟掛上去

test

開啟一台新的 VM

test

將剛剛卸載的開機磁碟掛上去

*開啟新的 VM 時,需要注意兩台 VM 要設置在相同的 Region 才能讀取到磁碟


3. 依照自己的需求,增加硬碟空間容量

test

管理磁碟 → 編輯 → 調整容量大小 → 儲存

4. 調整後,進入這台新的 VM 將硬碟磁區掛入 Linux 目錄,調整磁碟分割區空間

test

調整磁碟分割區空間

5. 將硬碟退出新的 VM,再掛回原 VM 的開機硬碟中。

test

新的 VM 退出磁碟

test

原本的 VM 設定開機磁碟

test

開機磁碟設定

6. 開機,完成磁碟空間擴增

Contact CloudMile

Contact Us

Proven Experience Across Diverse Industries

Phone Number

  • TW+886
  • TW+886
  • Reason for Inquiry

  • Electrum Advisory

  • MileInfra - Cloud Infrastructure Modernization

  • Enterprise Technical Training

  • MileSec - Multi-Cloud Security and Operations

  • MileData - Cloud Data Management and Automation

  • MileOps - Hybrid and Multi-Cloud Operations

  • MileAI - Generative AI Applications and Innovation

  • LumiTure.ai AI-Powered FinOps Platform

  • Other

  • 請填寫電子信箱