-
-
Save tsertkov/573d077012ae76443cbf to your computer and use it in GitHub Desktop.
Revisions
-
tsertkov revised this gist
Nov 6, 2014 . 2 changed files with 49 additions and 39 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,39 +0,0 @@ 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ #cloud-config coreos: units: - name: systemd-sysctl.service command: restart - name: create-swap.service command: start runtime: true content: | [Unit] Description=Create swap file Before=swap.service [Service] Type=oneshot Environment="SWAPFILE=/2GiB.swap" ExecStart=/usr/bin/touch ${SWAPFILE} ExecStart=/usr/bin/chattr +C ${SWAPFILE} ExecStart=/usr/bin/fallocate -l 2048m ${SWAPFILE} ExecStart=/usr/bin/chmod 600 ${SWAPFILE} ExecStart=/usr/sbin/mkswap ${SWAPFILE} [Install] WantedBy=multi-user.target - name: swap.service command: start content: | [Unit] Description=Turn on swap [Service] Type=oneshot Environment="SWAPFILE=/2GiB.swap" RemainAfterExit=true ExecStartPre=/usr/sbin/losetup -f ${SWAPFILE} ExecStart=/usr/bin/sh -c "/sbin/swapon $(/usr/sbin/losetup -j ${SWAPFILE} | /usr/bin/cut -d : -f 1)" ExecStop=/usr/bin/sh -c "/sbin/swapoff $(/usr/sbin/losetup -j ${SWAPFILE} | /usr/bin/cut -d : -f 1)" ExecStopPost=/usr/bin/sh -c "/usr/sbin/losetup -d $(/usr/sbin/losetup -j ${SWAPFILE} | /usr/bin/cut -d : -f 1)" [Install] WantedBy=multi-user.target write_files: - path: /etc/sysctl.d/swap.conf permissions: 0644 owner: root content: | vm.swappiness=10 vm.vfs_cache_pressure=50 -
kacinskas revised this gist
Sep 12, 2014 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -17,8 +17,6 @@ Type=oneshot Environment="SWAPFILE=/2GiB.swap" RemainAfterExit=true ExecStartPre=/usr/sbin/losetup -f ${SWAPFILE} ExecStart=/usr/bin/sh -c "/sbin/swapon $(/usr/sbin/losetup -j ${SWAPFILE} | /usr/bin/cut -d : -f 1)" ExecStop=/usr/bin/sh -c "/sbin/swapoff $(/usr/sbin/losetup -j ${SWAPFILE} | /usr/bin/cut -d : -f 1)" ExecStopPost=/usr/bin/sh -c "/usr/sbin/losetup -d $(/usr/sbin/losetup -j ${SWAPFILE} | /usr/bin/cut -d : -f 1)" -
kacinskas revised this gist
Sep 12, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -17,6 +17,8 @@ Type=oneshot Environment="SWAPFILE=/2GiB.swap" RemainAfterExit=true ExecStartPre=/usr/sbin/losetup -f ${SWAPFILE} ExecStartPre=sysctl vm.swappiness=10 ExecStartPre=sysctl vm.vfs_cache_pressure=50 ExecStart=/usr/bin/sh -c "/sbin/swapon $(/usr/sbin/losetup -j ${SWAPFILE} | /usr/bin/cut -d : -f 1)" ExecStop=/usr/bin/sh -c "/sbin/swapoff $(/usr/sbin/losetup -j ${SWAPFILE} | /usr/bin/cut -d : -f 1)" ExecStopPost=/usr/bin/sh -c "/usr/sbin/losetup -d $(/usr/sbin/losetup -j ${SWAPFILE} | /usr/bin/cut -d : -f 1)" -
kacinskas revised this gist
Sep 12, 2014 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -22,7 +22,7 @@ ExecStop=/usr/bin/sh -c "/sbin/swapoff $(/usr/sbin/losetup -j ${SWAPFILE} | /usr ExecStopPost=/usr/bin/sh -c "/usr/sbin/losetup -d $(/usr/sbin/losetup -j ${SWAPFILE} | /usr/bin/cut -d : -f 1)" [Install] WantedBy=multi-user.target # add service and start systemctl enable /etc/systemd/system/swap.service @@ -34,5 +34,6 @@ reboot # Options cat /proc/sys/vm/swappiness sysctl vm.swappiness=10 sysctl vm.vfs_cache_pressure=50 https://github.com/coreos/docs/issues/52 -
kacinskas revised this gist
Sep 12, 2014 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -25,10 +25,14 @@ ExecStopPost=/usr/bin/sh -c "/usr/sbin/losetup -d $(/usr/sbin/losetup -j ${SWAPF WantedBy=local.target # add service and start systemctl enable /etc/systemd/system/swap.service systemctl start swap # reboot reboot # Options cat /proc/sys/vm/swappiness sysctl vm.swappiness=10 https://github.com/coreos/docs/issues/52 -
kacinskas created this gist
Sep 12, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ # swith to sudo sudo -i # create swap touch /2GiB.swap chattr +C /2GiB.swap fallocate -l 2048m /2GiB.swap chmod 600 /2GiB.swap mkswap /2GiB.swap # create service unit to start swap [/etc/systemd/system/swap.service] [Unit] Description=Turn on swap [Service] Type=oneshot Environment="SWAPFILE=/2GiB.swap" RemainAfterExit=true ExecStartPre=/usr/sbin/losetup -f ${SWAPFILE} ExecStart=/usr/bin/sh -c "/sbin/swapon $(/usr/sbin/losetup -j ${SWAPFILE} | /usr/bin/cut -d : -f 1)" ExecStop=/usr/bin/sh -c "/sbin/swapoff $(/usr/sbin/losetup -j ${SWAPFILE} | /usr/bin/cut -d : -f 1)" ExecStopPost=/usr/bin/sh -c "/usr/sbin/losetup -d $(/usr/sbin/losetup -j ${SWAPFILE} | /usr/bin/cut -d : -f 1)" [Install] WantedBy=local.target # add service and start systemctl enable --runtime /etc/systemd/system/swap.service systemctl start swap # reboot reboot https://github.com/coreos/docs/issues/52