From 3beb89f8bf99153d1f41deeea7812dcc4b37cbe3 Mon Sep 17 00:00:00 2001
From: Clark Boylan <clark.boylan@gmail.com>
Date: Mon, 16 Oct 2017 17:25:34 -0700
Subject: [PATCH] Create more inodes on ephemeral partition fs

When we create the ext4 filesystem on the ephemeral device presented to
rax nodes do so with roughly twice the number of inodes as the default
ext4 bytes to inodes ratio.

We do this because we have found that we have in multiple cases needed
more inodes and that is difficult to deal with after the fact. This may
create more inodes than necessary in other cases but the cost is
relatively low (just more disk used).

Change-Id: Ie5414212f4505e98ba3ee8144ac90fcd05aa5b67
---
 make_swap.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/make_swap.sh b/make_swap.sh
index 2cee494ac6..6939ba82ac 100644
--- a/make_swap.sh
+++ b/make_swap.sh
@@ -48,7 +48,12 @@ if [ `grep SwapTotal /proc/meminfo | awk '{ print $2; }'` -eq 0 ]; then
         udevadm settle --timeout=10 --exit-if-exists=${DEV}2
 
         mkswap ${DEV}1
-        mkfs.ext4 ${DEV}2
+        # The default ratio is 16384 bytes per inode or so. Reduce that to 8192
+        # bytes per inode so that we get roughly twice the number of inodes as
+        # by default. This should still be well above the block size of 4096.
+        # We do this because we have found in at least a couple locations that
+        # more inodes is useful and is painful to fix after the fact.
+        mkfs.ext4 -i 8192 ${DEV}2
         swapon ${DEV}1
         mount ${DEV}2 /mnt
         rsync -a /opt/ /mnt/