I am using OpenBSD 7.7 (and 7.8) and I'm connecting via ssh with no
access to the boot.

Problem Y:
I can't find a way to stop using swap so that it doesn't cause the
partition to be busy.

First I use swapctl to stop using swap `b`

# swapctl
Device      512-blocks     Used    Avail Capacity  Priority
/dev/sd0b     16934264        0 16934264     0%    0
# swapctl -d /dev/sd0b
# swapctl
swapctl: no swap devices configured
# disklabel -E sd0
Label editor (enter '?' for help at any prompt)
sd0> d b
sd0*> q
Write new label?: [y] y
disklabel: DIOCWDINFO: Device busy
disklabel: unable to write label

So I commented out the swap b partition in fstab and rebooted. That
did nothing as the swapctl man says:
> The initial swap device (root disk, partition `b`) need not appear in 
> /etc/fstab, though it is not an error for it to do so.

Okay that explains why swap is still being used.
Now I comment this line out in /etc/rc:396:swapctl -A -t blk which I
would think would be the one activating the swap in the first place
(Wrong).
I reboot and swapctl is still showing sd0b is being used. Removing the
swap using swapctl still causes the device to be busy and I can't
prevent swap `b` from being used in the first place. I can't win.

Problem X:
As stated in the title this is an XY problem. I began trying to expand
my `a` partition from 1 GB to 1.1 GB and the 8GB swap space seemed
like a great work area to solve this remotely. I've successfully done
this before when OpenBSD went from root needing 800 MB to 1 GB. My
plan was to make a second root partition that was 1.1 GB and copy all
the root files there. Then reboot to the new root and adjust the
original `a` root partition to be 1.1 GB. Then reboot back to the
properly sized `a` partition.

Why ask this XY problem then?
>From what I understand is that fsck was needing a swap for checking
large file systems so I imagine this 'required' swap was implemented.
I am hoping that the stickiness of the swap is a bug. I would like it
if swapctl -d /dev/sd0b would relinquish the use of the `b` partition
so that disklabel can modify it.
One of the main reasons I enjoy using OpenBSD is that the system is
straightforward and there are no hidden tricks.
This feels like there is a hidden feature and magic is happening. This
possibly is reducing the flexible nature and maintainability of
OpenBSD.

-alfred

Reply via email to