Date: Mon, 21 Oct 2024 11:21:47 +0200 From: Stephane Rochoy <stephane.rochoy@stormshield.eu> To: <freebsd-hackers@freebsd.org> Subject: swapon vs GEOM labels Message-ID: <86ttd5rdze.fsf@cthulhu.stephaner.labo.int>
next in thread | raw e-mail | index | archive | help
Hi Hackers,
I'm playing with glabel(8) and swapon(8) but found a behavior that
is somewhat puzzling.
I boot main (b88df1e893c4) with an USB memstick plugged. The
memstick is da0 and hold a freebsd-swap partition, da0p1. This
partition was given the `swap` label using `glabel label` (i.e.,
an automatic label, stored somewhere into da0p1, AFAIK).
# glabel status
Name Status Components
label/swap N/A da0p1
Then I give the whole device the `usbmemstick` label using `glabel
create` (i.e., a manual label, not stored anywhere).
# glabel create usbmemstick da0
# glabel status
Name Status Components
label/swap N/A da0p1
label/usbmemstick N/A da0
What puzzle me is what happen when I enable swap:
# sysctl vm.nswapdev
vm.nswapdev: 0
# swapctl -l
Device: 1024-blocks Used:
# dumpon -l
/dev/null
# swapon /dev/label/usbmemstickp1
# glabel status
Name Status Components
label/usbmemstick N/A da0
# swapoff /dev/label/usbmemstickp1
# glabel status
Name Status Components
label/usbmemstick N/A da0
label/swap N/A label/usbmemstickp1
While swap is enabled, the `swap` label is no longer available. It
comes back when swap is disabled.
Note that I also tried to enable swap using the automatic label
(i.e., `swap`). In such a case this is the `usbmemstick` label
that vanish. And the label is even not restored on `swapoff`.
Is it the expected behavior? Am I doing something wrong?
Regards,
--
Stéphane Rochoy
O: Stormshield
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86ttd5rdze.fsf>
