UNOFFICIAL GUIDE: RUN SWAP OVER USB DRIVE IN PFSENSE
-
The labels are in
/dev/gpt/
, so replace the/dev/<device>
path infstab
with/dev/gpt/swapUSB
-
@jimp said in UNOFFICIAL GUIDE: RUN SWAP OVER USB DRIVE IN PFSENSE:
/dev/gpt/swapUSB
sorry to bug you just to confirm
I ran this
gpart add -t freebsd-swap -a 1M -s 8GB -l swapUSB da0now the label is no longer null
this has the entry
/dev/da0p1.eli none swap sw 0 0change this to
/dev/gpt/swapUSB.elifor /dev/ada0s3b that I have the link created to /dev/dumpdev
this as far as I know has no label on it so how would rc.dumpon find this dump can not use .eli so I have dump using the onboard SSD and not the usb. Should I make the label just USBswap that way it avoids it and uses the other entry?
I do not really want to use destroy to remove the label on /dev/ada0s3b
however this should have label swap0 for it so rc.dumpon can just locate that first?
-
@jimp I have no dev/gpt/ showing in my filesystem because that is the usb right?
-
You shouldn't have to destroy the existing swap on the disk to change the label.
# glabel label swap0 /dev/ada0s3b
And then when you reboot it should be fine.
The labels will disappear from
/dev/gpt/
when the partitions are mounted/in-use but you should see the right thing happening inswapinfo
and checking the dumpdev symlink.You shouldn't need to manually do anything other than adding the label and adjusting fstab.
-
You the Man!!
-
I have an issue after reboot
It shows both now with the swapinfo command
Shell Output - swapinfo -kh Device Size Used Avail Capacity /dev/gpt/swapUSB.eli 8.0G 0B 8.0G 0% /dev/label/swap0 6.6G 0B 6.6G 0% Total 15G 0B 15G 0%
It should only show /dev/gpt/swapUSB.eli for external swap because that is the only entry in the fstab file. However, both are being listed. the swap0 I only want for dump use coredumps because it is onboard ssd with the pfsense software swap would kill the drive faster. This was my issue before I couldn’t do coredumps on swapUSB because dump can’t use .eli so I wanted to separate swap from the coredumps location. For external usb based swap I want to use .eli to protect it from memory leaks so no one walks off with the drive with everything on it. I do not want to overload the onboard stuff because it is an SSD with pfsense.
dump on is correct thank you this does not use .eli it works does core dumps to that location. Weird that swapinfo shows both now that the labels are added. When is this checked what else loads the info into swap ?
DiagnosticsCommand Prompt Shell Output - dumpon -l label/swap0
-
The boot script should only be using swap entries listed in
/etc/fstab/
so make sure swap0 isn't in fstab at all. Therc.dumpon
script doesn't need an entry in fstab so long as the label exists. -
@jimp
I only have one entry in fstab what is weird after a reboot if I do swapinfo it shows both now.. I tested it did a crash and I do get coredumps now on the right drive and that is amazing !! If fstab lists one swap why is it now adding the swap0 to it and not just the swapUSB?
(Swapinfo showing 2 different swaps)
(What is listed in fstab)
Eli is loading also with the correct partition and encrypting on logs -
-
@JonathanLee FreeBSD has this idea of "device withering".
If your swap partition is NOT mounted/in use, you will likely see a "/dev/da0p2" AND a "/dev/gpt/whateverlabelyougaveit".
Then the first exclusive reference (think mount) makes everything else disappear.
if you do "swapon /dev/da0p2" the /dev/gpt disappears.
If you do "swapon /dev/gpt/whatever" the /dev/da0p2 will likely disappear (not always since this is basically raw device)
Your swapinfo showing both /dev/gpt/swapUSB.eli and /dev/label/swap0 indicate to me they are on 2 different physical devices.
If they are not different physical devices, you have something very odd going on. -
Yes swapusb is a usb and the other is the SSD on the device itself. Two different devices, also .Eli is in use so dump can not use that device only swap can
-
@mer I wonder if I do a cron job on it and swapon set it to be specific for usb if it would work, I opened a redmine as the current rc.dumpon does not include a if Eli and or if usb for situations like this. It was not closed right away so it could be fixed with a simple if else situation on the code.
-
Fix is to set swapoff on the other drive with a cron job no code is adapted. I am going to update my unofficial guide