Stephane Rochoy
2024-10-21 09:21:47 UTC
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
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
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
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de