當我在Google雲端平臺上創建實例時,如何增加默認的10GB啓動驅動器?我已經讀過關於這個的不同答案,沒有什麼超清。我是這個平臺的初學者,如果有人能告訴我如何以簡單的方式做到這一點,我會非常感激。調整默認的10GB啓動驅動器谷歌雲平臺
5
A
回答
1
的步驟很簡單:
- 具有更大的尺寸
- 創建一個從現有的源圖像的新的磁盤使用剛創建的磁盤創建一個新的實例(選擇現有的磁盤)
- 後,系統啓動,使用命令「df -h」,可以看到存儲仍然是9.9GB。
- 按照https://developers.google.com/compute/docs/disks
- 「重新分區根永久磁盤」部分中的步驟(從步驟4-12)完成!
12
使用以下步驟在Google雲端平臺上使用CentOS增加引導大小。
ssh into vm instance [[email protected] ~]$ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 9.9G 898M 8.5G 10%/ tmpfs 296M 0 296M 0% /dev/shm [[email protected] ~]$ sudo fdisk /dev/sda The device presents a logical sector size that is smaller than the physical sector size. Aligning to a physical sector (or optimal I/O) size boundary is recommended, or performance may be impacted. WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): p Disk /dev/sda: 53.7 GB, 53687091200 bytes 4 heads, 32 sectors/track, 819200 cylinders Units = cylinders of 128 * 512 = 65536 bytes Sector size (logical/physical): 512 bytes/4096 bytes I/O size (minimum/optimal): 4096 bytes/4096 bytes Disk identifier: 0x0004a990 Device Boot Start End Blocks Id System /dev/sda1 17 163825 10483712+ 83 Linux Command (m for help): c DOS Compatibility flag is not set Command (m for help): u Changing display/entry units to sectors Command (m for help): p Disk /dev/sda: 53.7 GB, 53687091200 bytes 4 heads, 32 sectors/track, 819200 cylinders, total 104857600 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes/4096 bytes I/O size (minimum/optimal): 4096 bytes/4096 bytes Disk identifier: 0x0004a990 Device Boot Start End Blocks Id System /dev/sda1 2048 20969472 10483712+ 83 Linux Command (m for help): p Disk /dev/sda: 53.7 GB, 53687091200 bytes 4 heads, 32 sectors/track, 819200 cylinders, total 104857600 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes/4096 bytes I/O size (minimum/optimal): 4096 bytes/4096 bytes Disk identifier: 0x0004a990 Device Boot Start End Blocks Id System /dev/sda1 2048 20969472 10483712+ 83 Linux Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 Partition 1 is already defined. Delete it before re-adding it. Command (m for help): d Selected partition 1 Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First sector (2048-104857599, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599): Using default value 104857599 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks. [[email protected] ~]$ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 9.9G 898M 8.5G 10%/ tmpfs 296M 0 296M 0% /dev/shm [[email protected] ~]$ sudo reboot Broadcast message from [email protected] (/dev/pts/0) at 3:48 ... The system is going down for reboot NOW! [[email protected] ~]$ Connection to 23.251.144.204 closed by remote host. Connection to 23.251.144.204 closed. Robetus-Mac:~ tomassiro$ gcutil listinstances --project="project-name" +-------+---------------+---------+----------------+----------------+ | name | zone | status | network-ip | external-ip | +-------+---------------+---------+----------------+----------------+ | srv-1 | us-central1-a | RUNNING | 10.230.224.112 | 107.168.216.20 | +-------+---------------+---------+----------------+----------------+ ssh into vm instance [[email protected] ~]$ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 9.9G 898M 8.5G 10%/ tmpfs 296M 0 296M 0% /dev/shm [[email protected] ~]$ sudo resize2fs /dev/sda1 resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/sda1 is mounted on /; on-line resizing required old desc_blocks = 1, new_desc_blocks = 4 Performing an on-line resize of /dev/sda1 to 13106944 (4k) blocks. The filesystem on /dev/sda1 is now 13106944 blocks long. [[email protected] ~]$ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 50G 908M 46G 2%/ tmpfs 296M 0 296M 0% /dev/shm [[email protected] ~]$ exit logout Connection to 23.251.144.204 closed.
0
不是編輯分區直接和不需要維護自己的圖像,更安全的方法,是dracut的growroot模塊&雲初始化。
我在Google Compute上使用了CentOS 6 & 7,Azure使用AWS &。
## you'll need to be root or use sudo
yum -y install epel-release
yum -y install cloud-init cloud-initramfs-tools dracut-modules-growroot cloud-utils-growpart
rpm -qa kernel | sed -e 's/^kernel-//' | xargs -I {} dracut -f /boot/initramfs-{}.img {}
# reboot for the resize to take affect
該分區將在下次啓動時自動調整大小。
注:
- 這是內置的Ubuntu,這就是爲什麼你看不到問題在那裏。
- 分區大小問題與RedHat & CentOS一起出現,大多數預構建映像不僅僅是Google Cloud。這種方法應該可以在任
相關問題
- 1. 如何在谷歌雲平臺上備份整臺機器?
- 2. 谷歌雲平臺架構
- 3. GTMSessionfetcher谷歌驅動器UPLOAD谷歌驅動器的目標C?
- 4. 谷歌雲平臺和容器
- 5. 使用谷歌驅動器作爲谷歌雲存儲
- 6. 谷歌雲視覺API:vision.detectText()不接受谷歌驅動器v3 URI
- 7. 谷歌驅動器Java認證
- 8. 谷歌驅動器認證在GWT
- 9. 谷歌雲啓動Wordpress網站超時後調整大小
- 10. 整合谷歌驅動器與Odoo 10
- 11. 谷歌驅動器sdk:致電谷歌驅動器sdk
- 12. 在谷歌雲平臺上連接到谷歌雲sql失敗
- 13. 谷歌驅動器保存到不工作(谷歌驅動API)
- 14. NoClassDefFoundErrror與谷歌驅動器
- 15. Acra和谷歌驅動器
- 16. httpsrequest谷歌驅動器refreshtoken
- 17. 谷歌驅動器api python
- 18. Getlink谷歌驅動器IPV4
- 19. 谷歌驅動器:redirect_uri_mismatch
- 20. 在谷歌驅動器
- 21. 如何啓動谷歌驅動器編輯器
- 22. 啓動存儲在谷歌驅動器上的應用程序
- 23. 雙啓動到Xen雲平臺和windows
- 24. 谷歌雲平臺 - 備份上傳
- 25. 將linode移植到谷歌雲平臺
- 26. 谷歌雲平臺和MSSQL 2008
- 27. 廣東話對谷歌雲平臺
- 28. 谷歌雲平臺身份驗證
- 29. 谷歌雲平臺 - 數據分佈
- 30. 谷歌雲平臺和星號
這可能是[這個問題](http://stackoverflow.com/q/24021214/3618671)的副本,也請看到答案張貼在那裏,如果他們足夠關閉這個問題。 –