[Unit] Description="Disable Transparent Hugepage before MongoDB boots" #WARN: check service name on your system # If you are using MongoDB Cloud, service name is "mongodb-mms-automation-agent.service" Before=mongodb.service [Service] Type=oneshot ExecStart=-/bin/bash -c 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' ExecStart=-/bin/bash -c 'echo never > /sys/kernel/mm/transparent_hugepage/defrag' ExecStart=-/bin/bash -c 'echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled' ExecStart=-/bin/bash -c 'echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag' ExecStart=-/bin/bash -c 'echo 0 > /sys/kernel/mm/transparent_hugepage/khugepaged/defrag' ExecStart=-/bin/bash -c 'echo 0 > /sys/kernel/mm/redhat_transparent_hugepage/khugepaged/defrag' ExecStart=-/bin/bash -c 'echo no > /sys/kernel/mm/transparent_hugepage/khugepaged/defrag' ExecStart=-/bin/bash -c 'echo no > /sys/kernel/mm/redhat_transparent_hugepage/khugepaged/defrag' [Install] #WARN: check service name on your system # If you are using MongoDB Cloud, service name is "mongodb-mms-automation-agent.service" RequiredBy=mongodb.service