How to create swapfile in easyos for low RAM pc?
Thanks.
How to create swapfile?
Moderator: BarryK
Re: How to create swapfile?
Create a new partition with file type '82 Linux swap' will do it.
The Linux kernel will auto detect the swap partition at boot.
Menu > System > Pdisk partition manager
or
Menu > Filesystem > GParted partition manager
Re: How to create swapfile?
@esos
That is a very good question. I haven't thought about a swap file for a very long time.
As Feodor reported, you can create a swap partition.
Here is the relevant code in /etc/rc.d/rc.sysinit, line 97:
Code: Select all
loadswap_func() { #w481 made into a function.
echo "LOAD SWAP"
for ONESWAP in `fdisk -l | grep ' Linux swap' | cut -f 1 -d ' ' | tr '\n' ' '`
do
echo -n "Loading swap partition $ONESWAP..." >/dev/console #loading swap partition
swapon $ONESWAP
status_func $?
[ $? -eq 0 ] && SWAPON="yes"
done
#if no go, try for a swap file...
if [ "$SWAPON" != "yes" ];then
SWAPFILE="/mnt/wkg/pupswap.swp" #20230413
if [ -f $SWAPFILE ];then
echo -n "Loading swap file ${SWAPFILE}..." >/dev/console
swapon $SWAPFILE
status_func $?
[ $? -eq 0 ] && SWAPON="yes"
fi
fi
}
...it first looks for a swap partition. Failing that, it looks for a swap file.
I have changed the path for $SWAPFILE, appended "/mnt/wkg", so that is in the working-partition.
Here is how to create 'pupswap.swp':
https://www.cyberciti.biz/faq/linux-add ... ile-howto/
If you do that on an SSD, it needs to be a high quality SSD that can sustain lots of writes.