Is there a way to make the pi use swap?

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there a way to make the pi use swap?

Gene Heskett-4
Greetings;

As I attempt to go beyond the original setup on the pi 3b, which was to
run linuxcnc on it.

But since it has 1/2 its cpu power left over, I am finding the lack of
memory to be a pita. Starting a camera application so I can calibrate
out the errors in the lathes mechanics then kills other services like
ssh, or even the whole thing so bad it needs a powerdown reboot.

I have a couple ssd's mounted each with a couple gigs of swap, but the pi
isn't using them, at least not as expected.

What would be the chain of things to check and adjust so it does use the
available swap?  There is a 10Gb defined in the /etc/fstab, on partition
sda2, one of the 2 ssd's plugged into a usb hub.

If swapon -a is run, I can see 999megs of swap in htop, which goes away
after a swapoff -a, both of course as sudo root.

Thanks for any clues.

--
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>

Reply | Threaded
Open this post in threaded view
|

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

Alan Corey
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.


On 9/14/18, Gene Heskett <[hidden email]> wrote:

> Greetings;
>
> As I attempt to go beyond the original setup on the pi 3b, which was to
> run linuxcnc on it.
>
> But since it has 1/2 its cpu power left over, I am finding the lack of
> memory to be a pita. Starting a camera application so I can calibrate
> out the errors in the lathes mechanics then kills other services like
> ssh, or even the whole thing so bad it needs a powerdown reboot.
>
> I have a couple ssd's mounted each with a couple gigs of swap, but the pi
> isn't using them, at least not as expected.
>
> What would be the chain of things to check and adjust so it does use the
> available swap?  There is a 10Gb defined in the /etc/fstab, on partition
> sda2, one of the 2 ssd's plugged into a usb hub.
>
> If swapon -a is run, I can see 999megs of swap in htop, which goes away
> after a swapoff -a, both of course as sudo root.
>
> Thanks for any clues.
>
> --
> Cheers, Gene Heskett
> --
> "There are four boxes to be used in defense of liberty:
>  soap, ballot, jury, and ammo. Please use in that order."
> -Ed Howdershelt (Author)
> Genes Web page <http://geneslinuxbox.net:6309/gene>
>
>


--
-------------
No, I won't  call it "climate change", do you have a "reality problem"? - AB1JX
Cities are cages built to contain excess people and keep them from
cluttering up nature.
Impeach  Impeach  Impeach  Impeach  Impeach  Impeach  Impeach  Impeach

Reply | Threaded
Open this post in threaded view
|

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

Gene Heskett-4
On Friday 14 September 2018 20:16:32 Alan Corey 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.

I found an error in the line above that in fstab, # it out.
Using htop as a swap monitor I can make the swap come and go.

Heres the fstab now:

proc                    /proc                   proc    defaults        0       0
PARTUUID=4fb6ef8f-01    /boot                   vfat    defaults        0       2
PARTUUID=4fb6ef8f-02    /                       ext4    defaults,noatime  0       1
# but lets see if a swap can be made to work
PARTUUID="000ba889-02"  none                    swap    defaults,nofail 0       0
#/dev/sda2      none    swap    sw,nofail
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
LABEL=bootpi    /media/boot                     vfat    defaults        0       2
LABEL=workpi1   /media/slash            ext4    defaults,noatime        0       1
LABEL=backuppi  /media/backupsd         ext4    defaults,noatime        0       1
LABEL=workpi120 /media/work                     ext4    defaults,noatime        0 1

But it doesn't show in a mount, nor does it show in a cat /etc/mtab:

/dev/root / ext4 rw,noatime,data=ordered 0 0
devtmpfs /dev devtmpfs rw,relatime,size=468264k,nr_inodes=117066,mode=755 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,relatime 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,nodev,mode=755 0 0
tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
cgroup /sys/fs/cgroup/systemd cgroup
rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd 0 0
cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0
cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
cgroup /sys/fs/cgroup/net_cls cgroup rw,nosuid,nodev,noexec,relatime,net_cls 0 0
tmpfs /etc/machine-id tmpfs ro,mode=755 0 0
systemd-1 /proc/sys/fs/binfmt_misc autofs
rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
mqueue /dev/mqueue mqueue rw,relatime 0 0
configfs /sys/kernel/config configfs rw,relatime 0 0
fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
/dev/mmcblk0p1 /boot vfat
rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro 0 0
/dev/sda1 /media/boot vfat
rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro 0 0
/dev/sdb1 /media/backupsd ext4 rw,noatime,data=ordered 0 0
/dev/sda3 /media/slash ext4 rw,noatime,stripe=8191,data=ordered 0 0
/dev/sdb2 /media/work ext4 rw,noatime,data=ordered 0 0
tmpfs /run/user/1000 tmpfs rw,nosuid,nodev,relatime,size=94520k,mode=700,uid=1000,gid=1000 0 0
gvfsd-fuse /run/user/1000/gvfs fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0

Which seems to be way too complex, but htop says its there. But I did a swapoff -a
then a sudo mkswap .dev/sda2 which reported:
pi@picnc:~ $ sudo mkswap /dev/sda2
mkswap: /dev/sda2: warning: wiping old swap signature.
Setting up swapspace version 1, size = 10239996 KiB
no label, UUID=7b06d9bc-18f2-4c25-957d-f426141664b3

So I copied that UUID into /etc/fstab, making this line:
UUID=7b06d9bc-18f2-4c25-957d-f426141664b3 swap     defaults,nofail 0 0
But now its not working at all.  What did I screw up?

I rebooted, and its found a 99meg swapfile, probably on the 32GB u-sd,
but not /dev/sda2 ???

Call me puzzled.

Thanks Alan

--
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>

Reply | Threaded
Open this post in threaded view
|

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

Gene Heskett-4
On Friday 14 September 2018 20:56:28 Gene Heskett wrote:

> On Friday 14 September 2018 20:16:32 Alan Corey 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.
>
> I found an error in the line above that in fstab, # it out.
> Using htop as a swap monitor I can make the swap come and go.
>
> Heres the fstab now:
>
> proc                    /proc                   proc    defaults      
>  0       0 PARTUUID=4fb6ef8f-01    /boot                   vfat  
> defaults        0       2 PARTUUID=4fb6ef8f-02    /                  
>    ext4    defaults,noatime  0       1 # but lets see if a swap can be
> made to work
> PARTUUID="000ba889-02"  none                    swap  
> defaults,nofail 0       0 #/dev/sda2      none    swap    sw,nofail
> # a swapfile is not a swap partition, no line here
> #   use  dphys-swapfile swap[on|off]  for that
> LABEL=bootpi    /media/boot                     vfat    defaults      
>  0       2 LABEL=workpi1   /media/slash            ext4  
> defaults,noatime        0       1 LABEL=backuppi  /media/backupsd    
>    ext4    defaults,noatime        0       1 LABEL=workpi120
> /media/work                     ext4    defaults,noatime        0 1
>
> But it doesn't show in a mount, nor does it show in a cat /etc/mtab:
>
> /dev/root / ext4 rw,noatime,data=ordered 0 0
> devtmpfs /dev devtmpfs
> rw,relatime,size=468264k,nr_inodes=117066,mode=755 0 0 sysfs /sys
> sysfs rw,nosuid,nodev,noexec,relatime 0 0
> proc /proc proc rw,relatime 0 0
> tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
> devpts /dev/pts devpts
> rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0 tmpfs /run
> tmpfs rw,nosuid,nodev,mode=755 0 0
> tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
> tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
> cgroup /sys/fs/cgroup/systemd cgroup
> rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/syste
>md-cgroups-agent,name=systemd 0 0 cgroup /sys/fs/cgroup/cpu,cpuacct
> cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0 cgroup
> /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
> cgroup /sys/fs/cgroup/memory cgroup
> rw,nosuid,nodev,noexec,relatime,memory 0 0 cgroup
> /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices
> 0 0 cgroup /sys/fs/cgroup/freezer cgroup
> rw,nosuid,nodev,noexec,relatime,freezer 0 0 cgroup
> /sys/fs/cgroup/net_cls cgroup rw,nosuid,nodev,noexec,relatime,net_cls
> 0 0 tmpfs /etc/machine-id tmpfs ro,mode=755 0 0
> systemd-1 /proc/sys/fs/binfmt_misc autofs
> rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct 0 0
> debugfs /sys/kernel/debug debugfs rw,relatime 0 0
> mqueue /dev/mqueue mqueue rw,relatime 0 0
> configfs /sys/kernel/config configfs rw,relatime 0 0
> fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
> /dev/mmcblk0p1 /boot vfat
> rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortna
>me=mixed,errors=remount-ro 0 0 /dev/sda1 /media/boot vfat
> rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortna
>me=mixed,errors=remount-ro 0 0 /dev/sdb1 /media/backupsd ext4
> rw,noatime,data=ordered 0 0
> /dev/sda3 /media/slash ext4 rw,noatime,stripe=8191,data=ordered 0 0
> /dev/sdb2 /media/work ext4 rw,noatime,data=ordered 0 0
> tmpfs /run/user/1000 tmpfs
> rw,nosuid,nodev,relatime,size=94520k,mode=700,uid=1000,gid=1000 0 0
> gvfsd-fuse /run/user/1000/gvfs fuse.gvfsd-fuse
> rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0
>
> Which seems to be way too complex, but htop says its there. But I did
> a swapoff -a then a sudo mkswap .dev/sda2 which reported:
> pi@picnc:~ $ sudo mkswap /dev/sda2
> mkswap: /dev/sda2: warning: wiping old swap signature.
> Setting up swapspace version 1, size = 10239996 KiB
> no label, UUID=7b06d9bc-18f2-4c25-957d-f426141664b3
>
> So I copied that UUID into /etc/fstab, making this line:
> UUID=7b06d9bc-18f2-4c25-957d-f426141664b3 swap     defaults,nofail 0 0
> But now its not working at all.  What did I screw up?
>
> I rebooted, and its found a 99meg swapfile, probably on the 32GB u-sd,
> but not /dev/sda2 ???
>
> Call me puzzled.

Got it, mount point was supposed to be none.  So swapon is working. Now,
I presume whatever handles  this at boot is in /lib/udev.d? I'll go
snoop in there.

Thanks Alan



--
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>

Reply | Threaded
Open this post in threaded view
|

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

Alan Corey
I don't know about that, I think it's the same in the BSDs and they
don't have udev.  It's maybe more memory than file.

vmstat should show it, and I think there's a swapctl, but those are
optionally installed things.

If you use Firefox you probably need it:
KiB Mem :   949444 total,    30988 free,   678588 used,   239868 buff/cache
KiB Swap:  4538548 total,  4113588 free,   424960 used.   248532 avail Mem
after 6 days of uptime

On 9/14/18, Gene Heskett <[hidden email]> wrote:

> On Friday 14 September 2018 20:56:28 Gene Heskett wrote:
>
>> On Friday 14 September 2018 20:16:32 Alan Corey 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.
>>
>> I found an error in the line above that in fstab, # it out.
>> Using htop as a swap monitor I can make the swap come and go.
>>
>> Heres the fstab now:
>>
>> proc                    /proc                   proc    defaults
>>  0       0 PARTUUID=4fb6ef8f-01    /boot                   vfat
>> defaults        0       2 PARTUUID=4fb6ef8f-02    /
>>    ext4    defaults,noatime  0       1 # but lets see if a swap can be
>> made to work
>> PARTUUID="000ba889-02"  none                    swap
>> defaults,nofail 0       0 #/dev/sda2      none    swap    sw,nofail
>> # a swapfile is not a swap partition, no line here
>> #   use  dphys-swapfile swap[on|off]  for that
>> LABEL=bootpi    /media/boot                     vfat    defaults
>>  0       2 LABEL=workpi1   /media/slash            ext4
>> defaults,noatime        0       1 LABEL=backuppi  /media/backupsd
>>    ext4    defaults,noatime        0       1 LABEL=workpi120
>> /media/work                     ext4    defaults,noatime        0 1
>>
>> But it doesn't show in a mount, nor does it show in a cat /etc/mtab:
>>
>> /dev/root / ext4 rw,noatime,data=ordered 0 0
>> devtmpfs /dev devtmpfs
>> rw,relatime,size=468264k,nr_inodes=117066,mode=755 0 0 sysfs /sys
>> sysfs rw,nosuid,nodev,noexec,relatime 0 0
>> proc /proc proc rw,relatime 0 0
>> tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
>> devpts /dev/pts devpts
>> rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0 tmpfs /run
>> tmpfs rw,nosuid,nodev,mode=755 0 0
>> tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
>> tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
>> cgroup /sys/fs/cgroup/systemd cgroup
>> rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/syste
>>md-cgroups-agent,name=systemd 0 0 cgroup /sys/fs/cgroup/cpu,cpuacct
>> cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0 cgroup
>> /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
>> cgroup /sys/fs/cgroup/memory cgroup
>> rw,nosuid,nodev,noexec,relatime,memory 0 0 cgroup
>> /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices
>> 0 0 cgroup /sys/fs/cgroup/freezer cgroup
>> rw,nosuid,nodev,noexec,relatime,freezer 0 0 cgroup
>> /sys/fs/cgroup/net_cls cgroup rw,nosuid,nodev,noexec,relatime,net_cls
>> 0 0 tmpfs /etc/machine-id tmpfs ro,mode=755 0 0
>> systemd-1 /proc/sys/fs/binfmt_misc autofs
>> rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct 0 0
>> debugfs /sys/kernel/debug debugfs rw,relatime 0 0
>> mqueue /dev/mqueue mqueue rw,relatime 0 0
>> configfs /sys/kernel/config configfs rw,relatime 0 0
>> fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
>> /dev/mmcblk0p1 /boot vfat
>> rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortna
>>me=mixed,errors=remount-ro 0 0 /dev/sda1 /media/boot vfat
>> rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortna
>>me=mixed,errors=remount-ro 0 0 /dev/sdb1 /media/backupsd ext4
>> rw,noatime,data=ordered 0 0
>> /dev/sda3 /media/slash ext4 rw,noatime,stripe=8191,data=ordered 0 0
>> /dev/sdb2 /media/work ext4 rw,noatime,data=ordered 0 0
>> tmpfs /run/user/1000 tmpfs
>> rw,nosuid,nodev,relatime,size=94520k,mode=700,uid=1000,gid=1000 0 0
>> gvfsd-fuse /run/user/1000/gvfs fuse.gvfsd-fuse
>> rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0
>>
>> Which seems to be way too complex, but htop says its there. But I did
>> a swapoff -a then a sudo mkswap .dev/sda2 which reported:
>> pi@picnc:~ $ sudo mkswap /dev/sda2
>> mkswap: /dev/sda2: warning: wiping old swap signature.
>> Setting up swapspace version 1, size = 10239996 KiB
>> no label, UUID=7b06d9bc-18f2-4c25-957d-f426141664b3
>>
>> So I copied that UUID into /etc/fstab, making this line:
>> UUID=7b06d9bc-18f2-4c25-957d-f426141664b3 swap     defaults,nofail 0 0
>> But now its not working at all.  What did I screw up?
>>
>> I rebooted, and its found a 99meg swapfile, probably on the 32GB u-sd,
>> but not /dev/sda2 ???
>>
>> Call me puzzled.
>
> Got it, mount point was supposed to be none.  So swapon is working. Now,
> I presume whatever handles  this at boot is in /lib/udev.d? I'll go
> snoop in there.
>
> Thanks Alan
>
>
>
> --
> Cheers, Gene Heskett
> --
> "There are four boxes to be used in defense of liberty:
>  soap, ballot, jury, and ammo. Please use in that order."
> -Ed Howdershelt (Author)
> Genes Web page <http://geneslinuxbox.net:6309/gene>
>
>


--
-------------
No, I won't  call it "climate change", do you have a "reality problem"? - AB1JX
Cities are cages built to contain excess people and keep them from
cluttering up nature.
Impeach  Impeach  Impeach  Impeach  Impeach  Impeach  Impeach  Impeach

Reply | Threaded
Open this post in threaded view
|

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

Gene Heskett-4
On Friday 14 September 2018 21:39:02 Alan Corey wrote:

> I don't know about that, I think it's the same in the BSDs and they
> don't have udev.  It's maybe more memory than file.
>
> vmstat should show it, and I think there's a swapctl, but those are
> optionally installed things.
>
vmstat seems to be installed, but the system is inactive except
for a pair of ssh -Y logins from me. It reports:
$ vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 2  0      0 605904  34156 172824    0    0    14     0  723  539  0  5 94  0  0

This in spite of htop saying theres 999 megs of swap available. So the above
needs a good manpage read to decode it. The 0 0 bothers me. Its supposed to
take an optional delay 10 for and infinite number of updates at 10 second
intervals, but barfs of the delay keyword. Lotta help that is.

swapctl can't be found.
pi@picnc:~ $ sudo apt install swapctl
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package swapctl

> If you use Firefox you probably need it:
> KiB Mem :   949444 total,    30988 free,   678588 used,   239868
> buff/cache KiB Swap:  4538548 total,  4113588 free,   424960 used.  
> 248532 avail Mem after 6 days of uptime

firefox is  not installed.

> On 9/14/18, Gene Heskett <[hidden email]> wrote:
> > On Friday 14 September 2018 20:56:28 Gene Heskett wrote:
> >> On Friday 14 September 2018 20:16:32 Alan Corey 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

I just nuked the swapfile in /var. We'll see what amanda does to
the swap in the morning. ;-)

> >> > Sounds like you're just not loading it from your fstab.  Should
> >> > load every boot.  Nothing new or tricky there.
> >>
> >> I found an error in the line above that in fstab, # it out.
> >> Using htop as a swap monitor I can make the swap come and go.
> >>
> >> Heres the fstab now:
> >>
> >> proc                    /proc                   proc    defaults
> >>  0       0 PARTUUID=4fb6ef8f-01    /boot                   vfat
> >> defaults        0       2 PARTUUID=4fb6ef8f-02    /
> >>    ext4    defaults,noatime  0       1 # but lets see if a swap can
> >> be made to work
> >> PARTUUID="000ba889-02"  none                    swap
> >> defaults,nofail 0       0 #/dev/sda2      none    swap    sw,nofail
> >> # a swapfile is not a swap partition, no line here
> >> #   use  dphys-swapfile swap[on|off]  for that
> >> LABEL=bootpi    /media/boot                     vfat    defaults
> >>  0       2 LABEL=workpi1   /media/slash            ext4
> >> defaults,noatime        0       1 LABEL=backuppi  /media/backupsd
> >>    ext4    defaults,noatime        0       1 LABEL=workpi120
> >> /media/work                     ext4    defaults,noatime        0 1
> >>
> >> But it doesn't show in a mount, nor does it show in a cat
> >> /etc/mtab:
> >>
> >> /dev/root / ext4 rw,noatime,data=ordered 0 0
> >> devtmpfs /dev devtmpfs
> >> rw,relatime,size=468264k,nr_inodes=117066,mode=755 0 0 sysfs /sys
> >> sysfs rw,nosuid,nodev,noexec,relatime 0 0
> >> proc /proc proc rw,relatime 0 0
> >> tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
> >> devpts /dev/pts devpts
> >> rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0 tmpfs
> >> /run tmpfs rw,nosuid,nodev,mode=755 0 0
> >> tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0
> >> 0 tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
> >> cgroup /sys/fs/cgroup/systemd cgroup
> >> rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/sy
> >>ste md-cgroups-agent,name=systemd 0 0 cgroup
> >> /sys/fs/cgroup/cpu,cpuacct cgroup
> >> rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0 cgroup
> >> /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0
> >> 0 cgroup /sys/fs/cgroup/memory cgroup
> >> rw,nosuid,nodev,noexec,relatime,memory 0 0 cgroup
> >> /sys/fs/cgroup/devices cgroup
> >> rw,nosuid,nodev,noexec,relatime,devices 0 0 cgroup
> >> /sys/fs/cgroup/freezer cgroup
> >> rw,nosuid,nodev,noexec,relatime,freezer 0 0 cgroup
> >> /sys/fs/cgroup/net_cls cgroup
> >> rw,nosuid,nodev,noexec,relatime,net_cls 0 0 tmpfs /etc/machine-id
> >> tmpfs ro,mode=755 0 0
> >> systemd-1 /proc/sys/fs/binfmt_misc autofs
> >> rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct 0
> >> 0 debugfs /sys/kernel/debug debugfs rw,relatime 0 0
> >> mqueue /dev/mqueue mqueue rw,relatime 0 0
> >> configfs /sys/kernel/config configfs rw,relatime 0 0
> >> fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
> >> /dev/mmcblk0p1 /boot vfat
> >> rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shor
> >>tna me=mixed,errors=remount-ro 0 0 /dev/sda1 /media/boot vfat
> >> rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shor
> >>tna me=mixed,errors=remount-ro 0 0 /dev/sdb1 /media/backupsd ext4
> >> rw,noatime,data=ordered 0 0
> >> /dev/sda3 /media/slash ext4 rw,noatime,stripe=8191,data=ordered 0 0
> >> /dev/sdb2 /media/work ext4 rw,noatime,data=ordered 0 0
> >> tmpfs /run/user/1000 tmpfs
> >> rw,nosuid,nodev,relatime,size=94520k,mode=700,uid=1000,gid=1000 0 0
> >> gvfsd-fuse /run/user/1000/gvfs fuse.gvfsd-fuse
> >> rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0
> >>
> >> Which seems to be way too complex, but htop says its there. But I
> >> did a swapoff -a then a sudo mkswap .dev/sda2 which reported:
> >> pi@picnc:~ $ sudo mkswap /dev/sda2
> >> mkswap: /dev/sda2: warning: wiping old swap signature.
> >> Setting up swapspace version 1, size = 10239996 KiB
> >> no label, UUID=7b06d9bc-18f2-4c25-957d-f426141664b3
> >>
> >> So I copied that UUID into /etc/fstab, making this line:
> >> UUID=7b06d9bc-18f2-4c25-957d-f426141664b3 swap     defaults,nofail
> >> 0 0 But now its not working at all.  What did I screw up?
> >>
> >> I rebooted, and its found a 99meg swapfile, probably on the 32GB
> >> u-sd, but not /dev/sda2 ???
> >>
> >> Call me puzzled.
> >
> > Got it, mount point was supposed to be none.  So swapon is working.
> > Now, I presume whatever handles  this at boot is in /lib/udev.d?
> > I'll go snoop in there.
> >
> > Thanks Alan
> >
> >
> >
> > --
> > Cheers, Gene Heskett
> > --
> > "There are four boxes to be used in defense of liberty:
> >  soap, ballot, jury, and ammo. Please use in that order."
> > -Ed Howdershelt (Author)
> > Genes Web page <http://geneslinuxbox.net:6309/gene>



--
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>

Reply | Threaded
Open this post in threaded view
|

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

Alan Corey
Yeah, vmstat shows me

procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  1 423424  43348  16380 212828    0    0     6     6    3    2  8  1 92  0  0

Do you have the sw field in your fstab?
/var/swap2 none swap sw 0 0
By the fsstab man page it's the type of the file system.  Or maybe
not.    The last 2 numbers have to do with dump/restore and fsck.

On 9/14/18, Gene Heskett <[hidden email]> wrote:

> On Friday 14 September 2018 21:39:02 Alan Corey wrote:
>
>> I don't know about that, I think it's the same in the BSDs and they
>> don't have udev.  It's maybe more memory than file.
>>
>> vmstat should show it, and I think there's a swapctl, but those are
>> optionally installed things.
>>
> vmstat seems to be installed, but the system is inactive except
> for a pair of ssh -Y logins from me. It reports:
> $ vmstat
> procs -----------memory---------- ---swap-- -----io---- -system--
> ------cpu-----
>  r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id
> wa st
>  2  0      0 605904  34156 172824    0    0    14     0  723  539  0  5 94
> 0  0
>
> This in spite of htop saying theres 999 megs of swap available. So the
> above
> needs a good manpage read to decode it. The 0 0 bothers me. Its supposed to
> take an optional delay 10 for and infinite number of updates at 10 second
> intervals, but barfs of the delay keyword. Lotta help that is.
>
> swapctl can't be found.
> pi@picnc:~ $ sudo apt install swapctl
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> E: Unable to locate package swapctl
>
>> If you use Firefox you probably need it:
>> KiB Mem :   949444 total,    30988 free,   678588 used,   239868
>> buff/cache KiB Swap:  4538548 total,  4113588 free,   424960 used.
>> 248532 avail Mem after 6 days of uptime
>
> firefox is  not installed.
>
>> On 9/14/18, Gene Heskett <[hidden email]> wrote:
>> > On Friday 14 September 2018 20:56:28 Gene Heskett wrote:
>> >> On Friday 14 September 2018 20:16:32 Alan Corey 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
>
> I just nuked the swapfile in /var. We'll see what amanda does to
> the swap in the morning. ;-)
>
>> >> > Sounds like you're just not loading it from your fstab.  Should
>> >> > load every boot.  Nothing new or tricky there.
>> >>
>> >> I found an error in the line above that in fstab, # it out.
>> >> Using htop as a swap monitor I can make the swap come and go.
>> >>
>> >> Heres the fstab now:
>> >>
>> >> proc                    /proc                   proc    defaults
>> >>  0       0 PARTUUID=4fb6ef8f-01    /boot                   vfat
>> >> defaults        0       2 PARTUUID=4fb6ef8f-02    /
>> >>    ext4    defaults,noatime  0       1 # but lets see if a swap can
>> >> be made to work
>> >> PARTUUID="000ba889-02"  none                    swap
>> >> defaults,nofail 0       0 #/dev/sda2      none    swap    sw,nofail
>> >> # a swapfile is not a swap partition, no line here
>> >> #   use  dphys-swapfile swap[on|off]  for that
>> >> LABEL=bootpi    /media/boot                     vfat    defaults
>> >>  0       2 LABEL=workpi1   /media/slash            ext4
>> >> defaults,noatime        0       1 LABEL=backuppi  /media/backupsd
>> >>    ext4    defaults,noatime        0       1 LABEL=workpi120
>> >> /media/work                     ext4    defaults,noatime        0 1
>> >>
>> >> But it doesn't show in a mount, nor does it show in a cat
>> >> /etc/mtab:
>> >>
>> >> /dev/root / ext4 rw,noatime,data=ordered 0 0
>> >> devtmpfs /dev devtmpfs
>> >> rw,relatime,size=468264k,nr_inodes=117066,mode=755 0 0 sysfs /sys
>> >> sysfs rw,nosuid,nodev,noexec,relatime 0 0
>> >> proc /proc proc rw,relatime 0 0
>> >> tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
>> >> devpts /dev/pts devpts
>> >> rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0 tmpfs
>> >> /run tmpfs rw,nosuid,nodev,mode=755 0 0
>> >> tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0
>> >> 0 tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
>> >> cgroup /sys/fs/cgroup/systemd cgroup
>> >> rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/sy
>> >>ste md-cgroups-agent,name=systemd 0 0 cgroup
>> >> /sys/fs/cgroup/cpu,cpuacct cgroup
>> >> rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0 cgroup
>> >> /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0
>> >> 0 cgroup /sys/fs/cgroup/memory cgroup
>> >> rw,nosuid,nodev,noexec,relatime,memory 0 0 cgroup
>> >> /sys/fs/cgroup/devices cgroup
>> >> rw,nosuid,nodev,noexec,relatime,devices 0 0 cgroup
>> >> /sys/fs/cgroup/freezer cgroup
>> >> rw,nosuid,nodev,noexec,relatime,freezer 0 0 cgroup
>> >> /sys/fs/cgroup/net_cls cgroup
>> >> rw,nosuid,nodev,noexec,relatime,net_cls 0 0 tmpfs /etc/machine-id
>> >> tmpfs ro,mode=755 0 0
>> >> systemd-1 /proc/sys/fs/binfmt_misc autofs
>> >> rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct 0
>> >> 0 debugfs /sys/kernel/debug debugfs rw,relatime 0 0
>> >> mqueue /dev/mqueue mqueue rw,relatime 0 0
>> >> configfs /sys/kernel/config configfs rw,relatime 0 0
>> >> fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
>> >> /dev/mmcblk0p1 /boot vfat
>> >> rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shor
>> >>tna me=mixed,errors=remount-ro 0 0 /dev/sda1 /media/boot vfat
>> >> rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shor
>> >>tna me=mixed,errors=remount-ro 0 0 /dev/sdb1 /media/backupsd ext4
>> >> rw,noatime,data=ordered 0 0
>> >> /dev/sda3 /media/slash ext4 rw,noatime,stripe=8191,data=ordered 0 0
>> >> /dev/sdb2 /media/work ext4 rw,noatime,data=ordered 0 0
>> >> tmpfs /run/user/1000 tmpfs
>> >> rw,nosuid,nodev,relatime,size=94520k,mode=700,uid=1000,gid=1000 0 0
>> >> gvfsd-fuse /run/user/1000/gvfs fuse.gvfsd-fuse
>> >> rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0
>> >>
>> >> Which seems to be way too complex, but htop says its there. But I
>> >> did a swapoff -a then a sudo mkswap .dev/sda2 which reported:
>> >> pi@picnc:~ $ sudo mkswap /dev/sda2
>> >> mkswap: /dev/sda2: warning: wiping old swap signature.
>> >> Setting up swapspace version 1, size = 10239996 KiB
>> >> no label, UUID=7b06d9bc-18f2-4c25-957d-f426141664b3
>> >>
>> >> So I copied that UUID into /etc/fstab, making this line:
>> >> UUID=7b06d9bc-18f2-4c25-957d-f426141664b3 swap     defaults,nofail
>> >> 0 0 But now its not working at all.  What did I screw up?
>> >>
>> >> I rebooted, and its found a 99meg swapfile, probably on the 32GB
>> >> u-sd, but not /dev/sda2 ???
>> >>
>> >> Call me puzzled.
>> >
>> > Got it, mount point was supposed to be none.  So swapon is working.
>> > Now, I presume whatever handles  this at boot is in /lib/udev.d?
>> > I'll go snoop in there.
>> >
>> > Thanks Alan
>> >
>> >
>> >
>> > --
>> > Cheers, Gene Heskett
>> > --
>> > "There are four boxes to be used in defense of liberty:
>> >  soap, ballot, jury, and ammo. Please use in that order."
>> > -Ed Howdershelt (Author)
>> > Genes Web page <http://geneslinuxbox.net:6309/gene>
>
>
>
> --
> Cheers, Gene Heskett
> --
> "There are four boxes to be used in defense of liberty:
>  soap, ballot, jury, and ammo. Please use in that order."
> -Ed Howdershelt (Author)
> Genes Web page <http://geneslinuxbox.net:6309/gene>
>
>


--
-------------
No, I won't  call it "climate change", do you have a "reality problem"? - AB1JX
Cities are cages built to contain excess people and keep them from
cluttering up nature.
Impeach  Impeach  Impeach  Impeach  Impeach  Impeach  Impeach  Impeach

Reply | Threaded
Open this post in threaded view
|

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

Gene Heskett-4
On Friday 14 September 2018 23:12:35 Alan Corey wrote:

> Yeah, vmstat shows me
>
> procs -----------memory---------- ---swap-- -----io---- -system--
> ------cpu----- r  b   swpd   free   buff  cache   si   so    bi    bo
>  in   cs us sy id wa st 0  1 423424  43348  16380 212828    0    0    
> 6     6    3    2  8  1 92  0  0
>
> Do you have the sw field in your fstab?

Do now, its down below but TLDR, so copied it again.

> /var/swap2 none swap sw 0 0

That's a swap"file". Using it is hard on the u-sd card. This swap is on a
300 meg/sec 120GB SSD. Ought to be 50x faster, making it semi-usable.

> By the fsstab man page it's the type of the file system.  Or maybe
> not.    The last 2 numbers have to do with dump/restore and fsck.

Which don't apply to swap, so they could be removed.

New line in etc/fstab that works for swapon -a now is:

UUID=7b06d9bc-18f2-4c25-957d-f426141664b3 none swap defaults,nofail 0 0

I nuked the /var/swap file, so we'll see how amanda works in 4 or 5
hours.

Thanks Alan.

--
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>

Reply | Threaded
Open this post in threaded view
|

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

Gene Heskett-4
On Friday 14 September 2018 23:36:27 Gene Heskett wrote:

> On Friday 14 September 2018 23:12:35 Alan Corey wrote:
> > Yeah, vmstat shows me
> >
> > procs -----------memory---------- ---swap-- -----io---- -system--
> > ------cpu----- r  b   swpd   free   buff  cache   si   so    bi  
> > bo in   cs us sy id wa st 0  1 423424  43348  16380 212828    0    0
> > 6     6    3    2  8  1 92  0  0
> >
> > Do you have the sw field in your fstab?
>
> Do now, its down below but TLDR, so copied it again.
>
> > /var/swap2 none swap sw 0 0
>
> That's a swap"file". Using it is hard on the u-sd card. This swap is
> on a 300 meg/sec 120GB SSD. Ought to be 50x faster, making it
> semi-usable.
>
> > By the fsstab man page it's the type of the file system.  Or maybe
> > not.    The last 2 numbers have to do with dump/restore and fsck.
>
> Which don't apply to swap, so they could be removed.
>
> New line in etc/fstab that works for swapon -a now is:
>
> UUID=7b06d9bc-18f2-4c25-957d-f426141664b3 none swap defaults,nofail 0
> 0
>
> I nuked the /var/swap file, so we'll see how amanda works in 4 or 5
> hours.
>
> Thanks Alan.

Worked fine, shows amanda used a meg of that swap, with nothing left in
the si/so columns. Tonight I'll leave LCNC running for S&G.


--
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>

Reply | Threaded
Open this post in threaded view
|

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

Alan Corey
Make sure you have rootwait in your cmdline.txt.  Just that word.  It tells the kernel to wait for a drive to spin up if needed.  I had several nasty hard crashes requiring repowering the Pi without it.  It would swap something out and expect to read it back instantly.  Meanwhile the drive had gone to sleep. Happened .most with memory hogs like Firefox and Gimp running when I'd walk away for >10 minutes.  With an SD card in a USB reader too, not just the hard drive. Maybe it's the Pi USB.  I was in chat with Startech tech support a bunch until I tried the drive on an i386 machine and it didn't happen. I try to not leave it mounted though.


Sent from my Motorola XT1527

On Sat, Sep 15, 2018, 9:20 AM Gene Heskett <[hidden email]> wrote:
On Friday 14 September 2018 23:36:27 Gene Heskett wrote:

> On Friday 14 September 2018 23:12:35 Alan Corey wrote:
> > Yeah, vmstat shows me
> >
> > procs -----------memory---------- ---swap-- -----io---- -system--
> > ------cpu----- r  b   swpd   free   buff  cache   si   so    bi   
> > bo in   cs us sy id wa st 0  1 423424  43348  16380 212828    0    0
> > 6     6    3    2  8  1 92  0  0
> >
> > Do you have the sw field in your fstab?
>
> Do now, its down below but TLDR, so copied it again.
>
> > /var/swap2 none swap sw 0 0
>
> That's a swap"file". Using it is hard on the u-sd card. This swap is
> on a 300 meg/sec 120GB SSD. Ought to be 50x faster, making it
> semi-usable.
>
> > By the fsstab man page it's the type of the file system.  Or maybe
> > not.    The last 2 numbers have to do with dump/restore and fsck.
>
> Which don't apply to swap, so they could be removed.
>
> New line in etc/fstab that works for swapon -a now is:
>
> UUID=7b06d9bc-18f2-4c25-957d-f426141664b3 none swap defaults,nofail 0
> 0
>
> I nuked the /var/swap file, so we'll see how amanda works in 4 or 5
> hours.
>
> Thanks Alan.

Worked fine, shows amanda used a meg of that swap, with nothing left in
the si/so columns. Tonight I'll leave LCNC running for S&G.


--
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>

Reply | Threaded
Open this post in threaded view
|

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

Gene Heskett-4
On Saturday 15 September 2018 11:04:37 Alan Corey wrote:

> Make sure you have rootwait in your cmdline.txt.  Just that word.  It
> tells the kernel to wait for a drive to spin up if needed.  I had
> several nasty hard crashes requiring repowering the Pi without it.  It
> would swap something out and expect to read it back instantly.
> Meanwhile the drive had gone to sleep. Happened .most with memory hogs
> like Firefox and Gimp running when I'd walk away for >10 minutes.
> With an SD card in a USB reader too, not just the hard drive. Maybe
> it's the Pi USB.  I was in chat with Startech tech support a bunch
> until I tried the drive on an i386 machine and it didn't happen. I try
> to not leave it mounted though.
>
The pi's internal usb is excedrin headache #1. All the pi's i/o except
the wifi and spi, have to fight for their turn at the internal usb hub
that interfaces to everything else.

keyboard and mouse events DO GET DROPPED. But LCNC uses its own spi
driver, so once you get the code past the usb pinhole, and onto the u-sd
card, the 42 megabit write and 25 megabit read runs the machinery quite
well. I have it doing a job that will take till at least tomorrow, a die
grinder in the tool post, makeing the angle of what is supposed to be an
MT5 taper, actually fit the spindle bore ground to the MT5 taper, but
the bed wear is now carved into the spindle, so I have to make stuff to
fit it with about an extra .0012" per inch so the tapers fit.

Thanks Alan.

--
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>

Reply | Threaded
Open this post in threaded view
|

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

Jeffrey Walton-3
In reply to this post by Alan Corey
On Fri, Sep 14, 2018 at 8:16 PM, Alan Corey <[hidden email]> 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

Reply | Threaded
Open this post in threaded view
|

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

Gene Heskett-4
On Saturday 15 September 2018 16:16:24 Jeffrey Walton wrote:

> On Fri, Sep 14, 2018 at 8:16 PM, Alan Corey <[hidden email]>
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.

Thanks Jeff.

--
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>

Reply | Threaded
Open this post in threaded view
|

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

Philip Hands
Gene Heskett <[hidden email]> writes:

> On Saturday 15 September 2018 16:16:24 Jeffrey Walton wrote:
>
>> On Fri, Sep 14, 2018 at 8:16 PM, Alan Corey <[hidden email]>
> 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

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).

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

signature.asc (847 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

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

Ian Campbell-5
On Mon, 2018-09-17 at 09:18 +0200, Philip Hands wrote:
> Gene Heskett <[hidden email]> writes:
> > 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:

Or one could try, for example:
   https://www.google.com/search?&q=linux%20swapiness
(which works even though I seemingly can't spell swappiness!)

It turns out there is a full-on wikipedia article on it, with links to
the documentation in the kernel source and everything...

Ian.

Reply | Threaded
Open this post in threaded view
|

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

Alan Corey
Even this Android phone has it set to 100 by default. Funny, in the BSDs I think it's more like swap strategy.

apropos helps sometimes but can't help if your man pages are incomplete.  At least you quickly find out if you misspelled apropos.

Then Google (or ducky).  Googling error messages is also useful.

Sent from my Motorola XT1527

On Mon, Sep 17, 2018, 4:17 AM Ian Campbell <[hidden email]> wrote:
On Mon, 2018-09-17 at 09:18 +0200, Philip Hands wrote:
> Gene Heskett <[hidden email]> writes:
> > 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:

Or one could try, for example:
   https://www.google.com/search?&q=linux%20swapiness
(which works even though I seemingly can't spell swappiness!)

It turns out there is a full-on wikipedia article on it, with links to
the documentation in the kernel source and everything...

Ian.

Reply | Threaded
Open this post in threaded view
|

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

Gene Heskett-4
In reply to this post by Philip Hands
On Monday 17 September 2018 03:18:09 Philip Hands wrote:

> Gene Heskett <[hidden email]> writes:
> > On Saturday 15 September 2018 16:16:24 Jeffrey Walton wrote:
> >> On Fri, Sep 14, 2018 at 8:16 PM, Alan Corey <[hidden email]>
> >
> > 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.

And the 2nd has to do with keyboard and mouse priority, as in it seems
they are last on the list to get a turn at the internal usb port,
resulting in (and highly variable percentage depending on unknown
factors during the boot, so it gets rebooted until it works) thrown away
mouse and keyboard events.

These two things can be made tolerable, but are a safety consideration
when they miss-behave, its running heavy machinery.

Finding a fix for those 2 problems would be appreciated very much.

Thanks Phil.

--
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>

Reply | Threaded
Open this post in threaded view
|

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

Philip Hands
Gene Heskett <[hidden email]> writes:

> On Monday 17 September 2018 03:18:09 Philip Hands wrote:
>
>> Gene Heskett <[hidden email]> writes:
>> > On Saturday 15 September 2018 16:16:24 Jeffrey Walton wrote:
>> >> On Fri, Sep 14, 2018 at 8:16 PM, Alan Corey <[hidden email]>
>> >
>> > 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

signature.asc (847 bytes) Download Attachment