Swapfile: Difference between revisions
From KlavoWiki
Jump to navigationJump to search
Created page with "I've written this based on my experience of Bananian which is Debian based. = Deleting Swap File = <pre> swapoff /swapfile1 </pre> <pre> rm -f /swapfile1 </pre> = Creating..." |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= Raspberry Pi = | |||
== Remove Swapfile == | |||
<pre> | |||
dphys-swapfile swapoff | |||
dphys-swapfile uninstall | |||
</pre> | |||
Remove dphys-swapfile application and dependency | |||
<pre> | |||
apt-get purge -y dphys-swapfile dc | |||
</pre> | |||
= Banana Pi = | |||
I've written this based on my experience of Bananian which is Debian based. | I've written this based on my experience of Bananian which is Debian based. | ||
= Deleting Swap File = | == Deleting Swap File == | ||
<pre> | <pre> | ||
swapoff /swapfile1 | swapoff /swapfile1 | ||
Line 43: | Line 57: | ||
</pre> | </pre> | ||
[[Category : Banana Pi]] [[Category : Linux]] | |||
= swapiness = | |||
<pre> | |||
vi /etc/sysctl.conf | |||
</pre> | |||
vm.swappiness Values | |||
{| | |||
|Value | |||
|Strategy | |||
|- | |||
|0 | |||
|The kernel will swap only to avoid an out of memory condition, when free memory will be below vm.min_free_kbytes limit. See the "VM Sysctl documentation". | |||
|- | |||
|1 | |||
|Kernel version 3.5 and over, as well as Red Hat kernel version 2.6.32-303 and over: Minimum amount of swapping without disabling it entirely. | |||
|- | |||
|10 | |||
|This value is sometimes recommended to improve performance when sufficient memory exists in a system. | |||
|- | |||
|60 | |||
|The default value. | |||
|- | |||
|100 | |||
|The kernel will swap aggressively. | |||
|} | |||
After reboot check current value | |||
<pre> | |||
cat /proc/sys/vm/swappiness | |||
</pre> | |||
[[Category : Raspbian]] [[Category : Banana Pi]] [[Category : Linux]] |
Latest revision as of 10:23, 20 August 2016
Raspberry Pi
Remove Swapfile
dphys-swapfile swapoff dphys-swapfile uninstall
Remove dphys-swapfile application and dependency
apt-get purge -y dphys-swapfile dc
Banana Pi
I've written this based on my experience of Bananian which is Debian based.
Deleting Swap File
swapoff /swapfile1
rm -f /swapfile1
Creating Swap File
Hard Disk Partition
The parition needs to be created as a swapfile and not ext3, ext4 or something else.
mktemp /dev/sda1
File
Create a file of 1GB
dd if=/dev/zero of=/swapfile1 bs=512 count=2048 chmod 600 /swapfile1 mkswap /swapfile1 swapon /swapfile1
fstabs
vi /etc/fstab
Add an entry or change the existing one
/dev/sda1 swap swap defaults 0 0
or
/swapfile1 swap swap defaults 0 0
swapiness
vi /etc/sysctl.conf
vm.swappiness Values
Value | Strategy |
0 | The kernel will swap only to avoid an out of memory condition, when free memory will be below vm.min_free_kbytes limit. See the "VM Sysctl documentation". |
1 | Kernel version 3.5 and over, as well as Red Hat kernel version 2.6.32-303 and over: Minimum amount of swapping without disabling it entirely. |
10 | This value is sometimes recommended to improve performance when sufficient memory exists in a system. |
60 | The default value. |
100 | The kernel will swap aggressively. |
After reboot check current value
cat /proc/sys/vm/swappiness