Skip to content

Commit 10ffc45

Browse files
authored
Merge pull request #1274 from buildkite/tmp-mount
Add MountTmpfsAtTmp parameter
2 parents 2a19a50 + 5bed1ea commit 10ffc45

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

packer/linux/conf/bin/bk-mount-instance-storage.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ exec > >(tee -a /var/log/elastic-stack.log | logger -t user-data -s 2>/dev/conso
2424

2525
echo "Starting ${BASH_SOURCE[0]}..."
2626

27+
if [[ "${BUILDKITE_MOUNT_TMPFS_AT_TMP:-true}" != "true" ]]; then
28+
echo "Disabling automatic mount of tmpfs at /tmp"
29+
30+
# "It is possible to disable the automatic mounting [...]
31+
# You may disable them simply by masking them:"
32+
# -- https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems/
33+
systemctl mask --now tmp.mount
34+
fi
35+
2736
# Mount instance storage if we can
2837
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html
2938

@@ -98,6 +107,6 @@ if [[ ! -f /etc/fstab.backup ]]; then
98107
echo Appened to /etc/fstab:
99108
cat /etc/fstab
100109
else
101-
echo /etc/fstab.backup already exists. Not mofidying /etc/fstab:
110+
echo /etc/fstab.backup already exists. Not modifying /etc/fstab:
102111
cat /etc/fstab
103112
fi

templates/aws-stack.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Metadata:
6767
- InstanceOperatingSystem
6868
- InstanceTypes
6969
- EnableInstanceStorage
70+
- MountTmpfsAtTmp
7071
- AgentsPerInstance
7172
- KeyName
7273
- SecretsBucket
@@ -501,6 +502,14 @@ Parameters:
501502
- "false"
502503
Default: "false"
503504

505+
MountTmpfsAtTmp:
506+
Type: String
507+
Description: Controls the filesystem mounted at /tmp. By default, /tmp is a tmpfs (memory-backed filesystem). Disabling this causes /tmp to be stored in the root filesystem.
508+
AllowedValues:
509+
- "true"
510+
- "false"
511+
Default: "true"
512+
504513
EnableCostAllocationTags:
505514
Type: String
506515
Description: Enables AWS Cost Allocation tags for all resources in the stack. See https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html
@@ -1228,6 +1237,7 @@ Resources:
12281237
Content-Type: text/x-shellscript; charset="us-ascii"
12291238
#!/bin/bash -v
12301239
BUILDKITE_ENABLE_INSTANCE_STORAGE="${EnableInstanceStorage}" \
1240+
BUILDKITE_MOUNT_TMPFS_AT_TMP="${MountTmpfsAtTmp}" \
12311241
/usr/local/bin/bk-mount-instance-storage.sh
12321242
--==BOUNDARY==
12331243
Content-Type: text/x-shellscript; charset="us-ascii"

0 commit comments

Comments
 (0)