9
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GCEインスタンスにPersistent Diskを割り当てる手順

Posted at

(1)まずはインスタンス作成
$ gcutil addinstance myinstance --zone=us-central1-a

(2)次にディスク作成
インスタンスと同一zoneに作る。デフォルトサイズは500GB。
$ gcutil adddisk mydisk —size_gb=500 --zone=us-central1-a

(3)インスタンスにディスクをAttachする
$ gcutil attachdisk --disk=mydisk --zone=us-central1-a myinstance

(4)作ったインスタンスにSSH接続
$ gcutil ssh myinstance

(5)ディスク使用量調べる
現状はこんな感じです。
$ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 9.9G 1.1G 8.3G 12% / tmpfs 296M 0 296M 0% /dev/shm

(6)割り当てるディレクトリ作成
$ sudo mkdir /mydisk

(7)Attachされたディスクがちゃんとあるか確認
$ ls -l /dev/disk/by-id/google-* lrwxrwxrwx. 1 root root 9 7月 18 02:56 2014 /dev/disk/by-id/google-mydisk -> ../../sdb lrwxrwxrwx. 1 root root 9 7月 18 02:46 2014 /dev/disk/by-id/google-myinstance -> ../../sda lrwxrwxrwx. 1 root root 10 7月 18 02:46 2014 /dev/disk/by-id/google-myinstance-part1 -> ../../sda1

(8)フォーマット&マウントをしてみる
$ sudo /usr/share/google/safe_format_and_mount -m "mkfs.ext4 -F" /dev/sdb /mydisk

(9)もう一度df -h
$ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 9.9G 1.1G 8.3G 12% / tmpfs 296M 0 296M 0% /dev/shm /dev/sdb 493G 198M 467G 1% /mydisk

無事割り当てられたっぽいです。

9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?