[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Is there a way to make the pi use swap?



Gene Heskett <gheskett@shentel.net> writes:

> On Monday 17 September 2018 03:18:09 Philip Hands wrote:
>
>> Gene Heskett <gheskett@shentel.net> writes:
>> > On Saturday 15 September 2018 16:16:24 Jeffrey Walton wrote:
>> >> On Fri, Sep 14, 2018 at 8:16 PM, Alan Corey <alan01346@gmail.com>
>> >
>> > wrote:
>> >> > My /etc/fstab just has
>> >> >  /var/swap2 none swap sw 0 0
>> >> > That's for a swap file which was made by dding 0s into it, then
>> >> > running mkswap.
>> >> >
>> >> > You'd replace /var/swap2 with /dev/sda2
>> >> >
>> >> > Sounds like you're just not loading it from your fstab.  Should
>> >> > load every boot.  Nothing new or tricky there.
>> >>
>> >> In addition, it also helps to set swappiness to a low value, like 1
>> >> or 3, on modern kernels. That has the effect of telling the kernel
>> >> to prefer to keep things in memory.
>> >>
>> >> With swapon and low swappiness I can actually run a C++ compiler
>> >> with multiple jobs and without an OOM kill.
>> >>
>> >> Jeff
>> >
>> > And pray tell, where does one set that swappiness?
>> > Sounds like something that could be handy.
>>
>> When wondering that sort of thing, I generally try this sort of
>> command to find out:
>>
>>   sudo find /sys /proc -name \*swappiness\* | less
>>
>> which in this case leads you quite quickly to /proc/sys/vm/swappiness
>>
>> which you can do things like:
>>
>>   cat /proc/sys/vm/swappiness
> currently 60
>> and
>>
>>   echo 1 > /proc/sys/vm/swappiness
>>
>> with.  Of course, that will only persist until the next reboot, so
>> you'd then want to set things in /etc/sysctl.* to make things
>> permanent.
>>
>> There are man pages for sysctl.d, sysctl.conf and sysctl, and also a
>> README in /etc/sysctl.d/
>>
>> Something like this (as root) would do the trick:
>>
>>   echo vm.swappiness=1 > /etc/sysctl.d/local-swapiness.conf
>>
>> (that's all true on Debian -- no idea how much of that applies for
>> *bian derivatives).
>>
> Like jessie for raspbian? Seems to be there, and that file/contents has 
> now been created. So we'll see if it helps.
>> Cheers, Phil.
>
> Thank you very much, Phil. But this leads to two more questions, the 
> first being:
>
> Can something along this general line by used to make the kernel 
> recognize at boot time, the settings contained in the (XFCE) 
> menu>preferences>keyboard-and-mouse? I have a pi-3b running jessie that 
> has a 500 cps keyboard repeat UNTIL this preference adjuster is run, 
> then closed w/o changing anything.

No idea I'm afraid -- I don't have any RaspberryPi stuff (as I don't
appreciate the binary blobs) and this seems like it's probably rather
specific to the equipment you are using.

Cheers, Phil.
-- 
|)|  Philip Hands  [+44 (0)20 8530 9560]  HANDS.COM Ltd.
|-|  http://www.hands.com/    http://ftp.uk.debian.org/
|(|  Hugo-Klemm-Strasse 34,   21075 Hamburg,    GERMANY

Attachment: signature.asc
Description: PGP signature


Reply to: