Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    UNOFFICIAL GUIDE: RUN SWAP OVER USB DRIVE IN PFSENSE

    Scheduled Pinned Locked Moved General pfSense Questions
    swapssdusb
    25 Posts 6 Posters 2.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JonathanLeeJ
      JonathanLee @jimp
      last edited by JonathanLee

      @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?

      04f1ec3b-0f5f-4fb0-aefd-ae88f3d9d1c8-image.png
      (Swapinfo showing 2 different swaps)

      93cb4fc9-c7d0-43a2-aa2b-7e6f72b71e04-image.png
      (What is listed in fstab)

      7a3e7b74-33de-4cdd-ac90-48ab228347d1-image.png
      Eli is loading also with the correct partition and encrypting on logs

      Make sure to upvote

      1 Reply Last reply Reply Quote 0
      • JonathanLeeJ
        JonathanLee
        last edited by

        a102eb6e-b279-4781-8aa6-19515eb41ae4-image.png

        Make sure to upvote

        1 Reply Last reply Reply Quote 0
        • M
          mer @JonathanLee
          last edited by

          @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.

          JonathanLeeJ 1 Reply Last reply Reply Quote 0
          • JonathanLeeJ
            JonathanLee
            last edited by JonathanLee

            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

            Make sure to upvote

            1 Reply Last reply Reply Quote 0
            • JonathanLeeJ
              JonathanLee @mer
              last edited by

              @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.

              Make sure to upvote

              M 1 Reply Last reply Reply Quote 0
              • JonathanLeeJ
                JonathanLee
                last edited by

                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

                Make sure to upvote

                1 Reply Last reply Reply Quote 0
                • M
                  mer @JonathanLee
                  last edited by

                  @JonathanLee Keep in mind "swapoff" may not immediately free up swap space. I think items in swap need to wind up getting released (basically the VM system recognizes no longer needed) before the swap device is actually taken offline.

                  1 Reply Last reply Reply Quote 0
                  • C
                    castleapp
                    last edited by

                    The unofficial guide for running swap over a USB drive in pfSense explains how to configure a USB drive as swap space. While it can help with memory shortages, it risks reduced performance and potential wear on the USB drive due to frequent read/write cycles. Use cautiously and consider alternatives like increasing RAM.

                    JonathanLeeJ 1 Reply Last reply Reply Quote 0
                    • JonathanLeeJ
                      JonathanLee @castleapp
                      last edited by JonathanLee

                      @castleapp your right. Again with how affordable usb sticks are why not have that hypothetical emergency gas tank. If you are worried about usb flash drive damage from overuse why not utilize a usb HDD for added longevity. Some systems can’t add memory as it is embedded. Merry Christmas

                      Make sure to upvote

                      1 Reply Last reply Reply Quote 0
                      • stephenw10S
                        stephenw10 Netgate Administrator
                        last edited by

                        Hmm @castleapp's reply reads like chatgpt, i.e. spam incoming....

                        JonathanLeeJ patient0P 2 Replies Last reply Reply Quote 0
                        • JonathanLeeJ
                          JonathanLee @stephenw10
                          last edited by

                          @stephenw10 I agree it is a little bit off.

                          Make sure to upvote

                          1 Reply Last reply Reply Quote 0
                          • patient0P
                            patient0 @stephenw10
                            last edited by

                            @stephenw10 I reported it as (possible) spam (category 'other) yesterday.

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.