LoginSignup
1
0

More than 3 years have passed since last update.

カタパルト稼働中のAmazon Linuxでinode枯渇しそうなのでディスク追加する

Last updated at Posted at 2019-06-09

はじめに

カタパルトを稼働しているマシンで、inodeが枯渇しそうというアラートが発生しました。inodeの残りがなくなると、止まってしまうので何か手を打たなければなりません。

今のマシンで使っているext4ファイルシステムでは、後からinodeの追加はできないので、新しいディスクを作って十分なinodeを確保しようと思います。

環境

マシン:AWS Lightsail $3.5のプラン
OS:Amazon Linux
Catapult:Cow

現状

現在のブロック数はだいたい46万ブロック。

image.png

ただし、このマシンでは、APIノードとRESTゲートウェイのみ動かしています。

inode使用率が80%を超えています。inodeの総数は131万になっています。

$ df -i
Filesystem      Inodes   IUsed  IFree IUse% Mounted on
devtmpfs         59024     438  58586    1% /dev
tmpfs            61669       1  61668    1% /dev/shm
/dev/xvda1     1310720 1088107 222613   84% /

ディスク使用率は51%です。

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        231M   60K  231M   1% /dev
tmpfs           241M     0  241M   0% /dev/shm
/dev/xvda1       20G   10G  9.6G  51% /

カタパルトのディレクトリを調べたところ、容量は5.1Gでした。

$ du -shc *
...
5.1G    total

なので、今回は16GBのディスクを追加したいと思います。ちなみに、16GBで$1.6/月です。

手順

公式の手順に従います。

Webコンソールからディスクを作成し、インスタンスにアタッチします。

xvdfが追加されました。

$ lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0  20G  0 disk 
└─xvda1 202:1    0  20G  0 part /
xvdf    202:80   0  16G  0 disk 

その後、インスタンスにSSHログインし、-iオプションを使用してファイルシステムを作成します。

$ sudo mkfs -t ext4 -i 4096 /dev/xvdf
mke2fs 1.43.5 (04-Aug-2017)
Creating filesystem with 4194304 4k blocks and 4194304 inodes
Filesystem UUID: de9c13a3-c6a8-4d15-a555-e3ab107a09de
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
    4096000

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

マウントします。

$ sudo mkdir /mnt/cow16
$ sudo mount /dev/xvdf /mnt/cow16

inodeは410万できています。

$ df -i
Filesystem      Inodes   IUsed   IFree IUse% Mounted on
devtmpfs         59024     451   58573    1% /dev
tmpfs            61669       1   61668    1% /dev/shm
/dev/xvda1     1310720 1088625  222095   84% /
/dev/xvdf      4194304      11 4194293    1% /mnt/cow16

ファイルを移動しました。inode使用率は24%になりました。inode使用数は96万です。

$ df -i
Filesystem      Inodes  IUsed   IFree IUse% Mounted on
devtmpfs         59024    451   58573    1% /dev
tmpfs            61669      1   61668    1% /dev/shm
/dev/xvda1     1310720 112247 1198473    9% /
/dev/xvdf      4194304 976673 3217631   24% /mnt/cow16

46万ブロックで24%の使用率なので、184万ブロックくらいまでは何とかなるでしょうか。

他の方法

こちらのslackチャネルでやりとりがされていました。

Yoshiyuki
config-node.properties.mtshouldAuditDispatcherInputs = falseに設定することで、audit/が作られなくなるので、必要がなければ停止することでディスク容量を節約できます。

Jaguar0625
auditing provides additional information in case there is a problem, but they are safe to disable and/or delete periodically

おわりに

ディスク使用量はそれほどではないものの、ファイル数が多くinodeが足りなくなる現象が起きました。

ディスク追加で対応が可能だということがわかりました。

46万ブロックの時点で、inodeは96万個使われているとういことがわかりました。

1
0
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
1
0