LoginSignup
5
4

More than 5 years have passed since last update.

GCEにxfsマウントのdiskを追加する

Last updated at Posted at 2016-02-28

Goggle Cloud PlatfomでのCompute Engineに追加Dickを入れてxfsマウントをするまでのメモ

まず、コンソールなどからdiskを追加する(今回はdataという名前で追加した)

追加したdiskの確認

$ ls -l /dev/disk/by-id/
lrwxrwxrwx. 1 root root  9 Feb 28 13:42 google-data -> ../../sdb
...

で追加したdisk名がgoogle-dataという感じで存在する

xfsフォーマットさせてマウントする

$ yum -y install xfsprogs
$ mkfs.xfs -f -b size=4096 -i size=512 -l size=64m /dev/sdb
$ mkdir /mnt/data
$ mount -t xfs -o noatime,logbufs=8 /dev/sdb /mnt/data

確認

$ df -Th
Filesystem     Type   Size  Used Avail Use% Mounted on
/dev/sda1      ext4   9.8G  1.2G  8.1G  13% /
tmpfs          tmpfs   15G     0   15G   0% /dev/shm
/dev/sdb       xfs    100G   33M  100G   1% /mnt/data

はい、おわり。

追記(2016/4/6)

ダウンタイム無しでdiskをリサイズできるようになったみたい。
http://googlecloudplatform-japan.blogspot.jp/2016/04/google-cloud-persistent-disks.html

GCPの管理画面からdiskのサイズ変更が出来た。インスタンスの画面をリロードしたらサイズ変更されていた

今回は100Gから300Gに変更してみた。

拡張する (xfs形式ではxfs_growfsで行うみたい)

$ xfs_growfs /dev/sdb
meta-data=/dev/sdb               isize=512    agcount=16, agsize=1638400 blks
         =                       sectsz=4096  attr=2, projid32bit=0
data     =                       bsize=4096   blocks=26214400, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal               bsize=4096   blocks=16384, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 26214400 to 78643200

確認

$ df -Th
Filesystem     Type   Size  Used Avail Use% Mounted on
/dev/sda1      ext4   9.8G  1.2G  8.1G  13% /
tmpfs          tmpfs  1.8G     0  1.8G   0% /dev/shm
/dev/sdb       xfs    300G   35M  300G   1% /mnt/data
5
4
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
5
4