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

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



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 to: