swap space issues

Donald Wilde dwilde1 at gmail.com
Thu Jun 25 15:04:55 UTC 2020


On 6/25/20, Kevin Oberman <rkoberman at gmail.com> wrote:
> On Thu, Jun 25, 2020 at 4:42 AM Donald Wilde <dwilde1 at gmail.com> wrote:
>
>> On 6/24/20, Kevin Oberman <rkoberman at gmail.com> wrote:
>> > On Wed, Jun 24, 2020 at 10:30 PM Greg 'groggy' Lehey <grog at freebsd.org>
>> > wrote:
>> >
>> >> On Wednesday, 24 June 2020 at 20:34:24 -0700, Donald Wilde wrote:
>> >> > On 6/24/20, Greg 'groggy' Lehey <grog at freebsd.org> wrote:
>> >> >> On Wednesday, 24 June 2020 at 18:51:04 -0700, Donald Wilde wrote:
>> >> >>> On 6/24/20, Greg 'groggy' Lehey <grog at freebsd.org> wrote:
>> >> >>>> On Wednesday, 24 June 2020 at  9:36:23 -0700, Donald Wilde wrote:
>> >> >>>>> All,
>> >> >>>>>
>> >> >>>>> I recently upgraded my 12-STABLE system to the latest, and now
>> >> >>>>> my
>> >> >>>>> swap subsystems aren't working. I deliberately set up a 40GB
>> >> >>>>> partition for swap, and when I do 'top -t' I am only seeing
>> >> >>>>> 7906M
>> >> >>>>> total.
>> >> >>>>
>> >> >>>> That looks suspiciously like the difference from 32 GB.  Could it
>> be
>> >> >>>> numeric overflow?  And if so, where?  What does pstat -s say?
>> >> >>>
>> >> >>> Well, hi Greg! LTNT2!
>> >> >>
>> >> >> Indeed.
>> >> >>
>> >> >>> pstat -shm:
>> >> >>>
>> >> >>> /dev/ada0s1b  65536 (1M blocks), Used: 1.5G, Avail: 63G, Capacity:
>> 2%
>> >> >>
>> >> >> Now that's really puzzling.  Why does it say 64 G when you said 40
>> >> >> G,
>> >> >> and the error from top tends to confirm it?  How big is the
>> >> >> partition
>> >> >> (gpart output)?
>> >> >
>> >> > Attached 'gpart list' output
>> >>
>> >> FWIW, gpart show would have done the job.  But what I see there is Yet
>> >> Another swap partition size, 66 GB.   So so far we have various parts
>> >> reporting 8 GB, 40 GB, 64 GB and 66 GB.
>> >>
>> >> > Reduced kern.maxswzone to 9999999. Is it decimal or unlabeled hex?
>> >>
>> >> It'll be decimal, but it refers to the number of swblk structures
>> >> assigned in memory, and after reading the code I'm still not 100% in
>> >> the clear how this relates to the size of swap, if at all.
>> >>
>> >> > 'top' now shows 4597M total swap.
>> >>
>> >> ... and 4.6 GB.  5 different sizes.
>> >>
>> >> You really shouldn't be relying on top for swap info.  It's a third
>> >> party program that demonstrably shows incorrect results (though I
>>
>> I was continuing to reference it because its 'incorrect results' might
>> flag where we need to see things working. When 'top' shows the right
>> results, we've fixed the right thing.
>>
>> >> believe that the maintainer would be very interested to know why and
>> >> to fix it).  But pstat -s (without any further options) should show
>> >> what the kernel thinks.
>>
>> Here's what I see immediately following shutdown -r and boot:
>>
>> Device          1K-blocks     Used    Avail Capacity
>> /dev/ada0s1b     67108864        0 67108864     0%
>>
>> >>
>> >> >>> What else can I share to help diagnose this?
>> >> >>
>> >> >> Background, maybe?  You say that you upgraded your system.  Did you
>> >> >> change the swap size when you did?  What were swap and RAM sizes
>> >> >> before and after?
>> >> >
>> >> > Meant that I upgraded from 12.1-RELEASE to 12-STABLE. When I
>> >> > configured the -RELEASE install, I manually messed with the MBR disk
>> >> > partitions. This is nominally a half-TB HDD which showed up as a
>> >> > total
>> >> > of 446 G available (IIRC, gpart should show it's actual size). I did
>> >> > auto partitioning, looked at the sizes, and manually set my
>> >> > partitions
>> >> > to give me 40G of swap instead of the auto-generated size of 4G.
>> >>
>> >> That's really puzzling.  It seems that it gave you much more than you
>> >> asked for.
>> >>
>> >> Try this in single user mode: modify the size of the swap partition to
>> >> 30 GB.  I haven't used MBR partitions for years now, but I believe
>> >> that 'bsdlabel -e' will do the trick.  Just shorten the length of the
>> >> b partition.  You may need to 'mount -u /'.  If you do it right
>> >> (check!), this won't harm any of the other partitions: it'll just
>> >> leave 26 GB free between the swap partition and the next partition.
>>
>> Thanks again, Greg!
>>
>> >>
>> > gpart(8) works just fine on MBR drives and partitions/slices and has a
>> much
>> > friendlier user interface. "gpart resize"  is the command you want.
>> > --
>> > Kevin Oberman, Part time kid herder and retired Network Engineer
>>
>> Thanks, Kevin! My laptop's BIOS is old enough that it balked when I
>> tried to boot from a GPT setup of 12.1R. One Of These Days I'll fix
>> that but the MBR works and I needed to move on.
>>
>> We'll get there! :D
>>
>
> I think a lot of people miss the point that the fact that gpart was written
> primarily to provide support  GPT partitioning, it also supports MBR and
> bsdlabel is really obsolete. gpart(8) supports 7 different partitioning
> schemes including the old RAW scheme, GPT and MBR. I still have an MBR disk
> on my near decade old laptop and I use gpart on it.

I have been bouncing around between gpart and geom, seeking to
understand them better. The man page is... obtuse... but I'm
understanding more of it now. geom and gpart seem to be rather
self-referential. <wink>

Here's /etc/fstab:

# Device	Mountpoint	FStype	Options	Dump	Pass#
/dev/ada0s1a	/		ufs	rw	1	1
/dev/ada0s1b	none		swap	sw	0	0
/dev/ada0s1d	none		swap	sw	0	0
fdesc		/dev/fd		fdescfs	rw	0	0
proc		/proc		procfs	rw	0	0

Here's /boot/loader.conf:

security.bsd.allow_destructive_dtrace=0
loader_logo="beastie"
kern.maxproc=75000
kern.maxswzone=25600001

Attached is 'gpart list' output.

top is still not happy, but it now shows 11G.

I think I'm ready to try synth again. :D

I also think it's time for a new thread, because I still have one
niggling issue.

Thanks for all your help, guys! :D
[end thread]
-- 
Don Wilde
****************************************************
* What is the Internet of Things but a system *
* of systems including humans?                     *
****************************************************
-------------- next part --------------
Geom name: ada0
modified: false
state: OK
fwheads: 16
fwsectors: 63
last: 976773167
first: 63
entries: 4
scheme: MBR
Providers:
1. Name: ada0s1
   Mediasize: 500107829248 (466G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r3w3e4
   efimedia: HD(1,MBR,0x90909090,0x40,0x3a385ff0)
   attrib: active
   rawtype: 165
   length: 500107829248
   offset: 32768
   type: freebsd
   index: 1
   end: 976773167
   start: 64
Consumers:
1. Name: ada0
   Mediasize: 500107862016 (466G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r3w3e7

Geom name: ada0s1
modified: false
state: OK
fwheads: 16
fwsectors: 63
last: 976773103
first: 0
entries: 8
scheme: BSD
Providers:
1. Name: ada0s1a
   Mediasize: 429496729600 (400G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e1
   rawtype: 7
   length: 429496729600
   offset: 0
   type: freebsd-ufs
   index: 1
   end: 838860799
   start: 0
2. Name: ada0s1b
   Mediasize: 34359738368 (32G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e0
   rawtype: 1
   length: 34359738368
   offset: 429496729600
   type: freebsd-swap
   index: 2
   end: 905969663
   start: 838860800
3. Name: ada0s1d
   Mediasize: 34359738368 (32G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e0
   rawtype: 1
   length: 34359738368
   offset: 463856467968
   type: freebsd-swap
   index: 4
   end: 973078527
   start: 905969664
4. Name: ada0s1e
   Mediasize: 1891622912 (1.8G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r0w0e0
   rawtype: 7
   length: 1891622912
   offset: 498216206336
   type: freebsd-ufs
   index: 5
   end: 976773103
   start: 973078528
Consumers:
1. Name: ada0s1
   Mediasize: 500107829248 (466G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r3w3e4



More information about the freebsd-stable mailing list