I have been using the new Raspbian Buster OS on a Raspberry Pi 4 with 4GB of memory. I have also added a 750GB external HDD to the PI and placed a 8GB swap file on this external harddrive. Below is my configuration as per multiple tutorials and posts online.
Code: Select all
# /etc/dphys-swapfile - user settings for dphys-swapfile package
# author Neil Franklin, last modification 2010.05.05
# copyright ETH Zuerich Physics Departement
# use under either modified/non-advertising BSD or GPL license
# this file is sourced with . so full normal sh syntax applies
# the default settings are added as commented out CONF_*=* lines
# where we want the swapfile to be, this is the default
CONF_SWAPFILE=/mnt/external/swapfile
# set size to absolute value, leaving empty (default) then uses computed value
# you most likely don't want this, unless you have an special disk situation
CONF_SWAPSIZE=8192
# set size to computed value, this times RAM size, dynamically adapts,
# guarantees that there is enough swap without wasting disk space on excess
#CONF_SWAPFACTOR=2
# restrict size (computed and absolute!) to maximally this limit
# can be set to empty for no limit, but beware of filled partitions!
# this is/was a (outdated?) 32bit kernel limit (in MBytes), do not overrun it
# but is also sensible on 64bit to prevent filling /var or even / partition
CONF_MAXSWAP=8192
Code: Select all
[email protected]:~/src $ free -h
total used free shared buff/cache available
Mem: 3.9Gi 235Mi 377Mi 147Mi 3.3Gi 3.4Gi
Swap: 8.0Gi 3.0Mi 8.0Gi
Also when I look at "top" it doesn't ever go into this swap space.
Code: Select all
top - 17:49:01 up 1:44, 3 users, load average: 0.04, 0.68, 2.49
Tasks: 134 total, 1 running, 133 sleeping, 0 stopped, 0 zombie
%Cpu0 : 1.0 us, 0.0 sy, 0.0 ni, 99.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu1 : 1.0 us, 1.0 sy, 0.0 ni, 98.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu2 : 1.0 us, 1.9 sy, 0.0 ni, 97.1 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu3 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 3955.6 total, 377.4 free, 235.1 used, 3343.1 buff/cache
MiB Swap: 8192.0 total, 8188.5 free, 3.5 used. 3431.3 avail Mem
All processing and large compilations fail with a "out of memory error" but it never uses the swap space. Does anyone have an idea why it won't allow me to use any of the swap space?
Any suggestions to resolve this will be much appreciated.