Sebastien Marie <[email protected]> wrote:

> On Wed, Nov 20, 2019 at 11:47:39PM -0800, Sean Kamath wrote:
> > Hello.
> > 
> > Can someone provide me a pointer to how to do this?
> > 
> > I have a bunch of Alix 2d13 boxes.  With 6.6, I’ve found I need more swap 
> > than the default layout on a 2G compact flash drive has.  So, I got some 1G 
> > USB thumb drives, and want to use JUST those for swap.  Despite different 
> > attempts (setting the mount_opts to xx, setting mount_opts to 
> > “priority=1”), I can’t seem to prevent the swap on the boot disk being 
> > added with priority = 0.  
> > 
> > Can I do anything to turn it off or change the priority, short of changing 
> > the filesystem type?
> 
> If I recall correctly, the swap on the boot disk is directly added by the
> kernel, and not by rc(8). It is why priority in fstab(5) is ignored.

config          bsd     swap generic

It is part of the "swap generic" logic.

> But you could change the priority of an already added swap with swapctl(8):
> 
> # swapctl -c -p 1 myduid.b
> 
> And you could automatically run it at boot-time by adding the command line in
> /etc/rc.local file, which is sourced by rc(8).
> 
> # echo 'swapctl -c -p 1 myduid.b' >> /etc/rc.local
> 
> This way, at boot time:
> - kernel adds the boot disk swap with priority 0
> - rc(8) adds the second swap with priority 0 (as configured in fstab(5))
> - rc(8) via rc.local changes the boot disk swap with priority 1
> - system will run with two swaps:
>   - second swap, priority 0, so used first
>   - boot disk swap, priority 1, used if second swap is full or by kernel for 
> dumping kernel core
> 
> I hope it helps.

It could help.  Or, leave it alone.

If you hit swap, you've learned something:  Your machine is too small.

Reply via email to