Last active
November 28, 2017 02:27
-
-
Save joshix/477822a5021bb22980805fdac6f915b5 to your computer and use it in GitHub Desktop.
Adding swap on CoreOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Service] | |
| Type=oneshot | |
| Environment="SWAP_PATH=/var/vm" "SWAP_FILE=swapfile1" | |
| ExecStartPre=-/usr/bin/rm -rf ${SWAP_PATH} | |
| ExecStartPre=/usr/bin/mkdir -p ${SWAP_PATH} | |
| ExecStartPre=/usr/bin/touch ${SWAP_PATH}/${SWAP_FILE} | |
| ExecStartPre=/bin/bash -c "fallocate -l 1024m ${SWAP_PATH}/${SWAP_FILE}" | |
| ExecStartPre=/usr/bin/chmod 600 ${SWAP_PATH}/${SWAP_FILE} | |
| ExecStartPre=/usr/sbin/mkswap ${SWAP_PATH}/${SWAP_FILE} | |
| ExecStartPre=/usr/sbin/sysctl vm.swappiness=10 | |
| ExecStart=/sbin/swapon ${SWAP_PATH}/${SWAP_FILE} | |
| ExecStop=/sbin/swapoff ${SWAP_PATH}/${SWAP_FILE} | |
| ExecStopPost=-/usr/bin/rm -rf ${SWAP_PATH} | |
| RemainAfterExit=true | |
| [Install] | |
| WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment