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

    How to add swapspace

    Scheduled Pinned Locked Moved General pfSense Questions
    18 Posts 6 Posters 7.9k 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.
    • M
      minph
      last edited by

      Hi

      I got 1GB of RAM on this box. It's not possible to add more RAM.

      No matter how complex it is, where can I find straight-forward information about adding swap? Thanks

      1 Reply Last reply Reply Quote 0
      • D
        doktornotor Banned
        last edited by

        Why are you running nanobsd in the first place?

        1 Reply Last reply Reply Quote 0
        • K
          kejianshi
          last edited by

          You are asking for help to break your pfsense. 
          Having a cache/swap will destroy your flashdrive in VERY short order.
          (Unless that 32GB can take alot of writes?)

          What exactly is the model of your drive?    <<<<<

          IF (This is a big if) its a very good one, you should just move to full install.

          1 Reply Last reply Reply Quote 0
          • M
            minph
            last edited by

            No, I wrote its running on a mSATA-Disk, that's SSD not USB-flash.

            I am just using the nanoimage becasue first I had it on an 4G-USB and it was working well and since I didn't want to reinstall, I just wrote the USB-image from da0 to ad0.

            1 Reply Last reply Reply Quote 0
            • J
              jasonlitka
              last edited by

              You should either do a config backup and then reinstall the full version of pfSense or reconfigure snort with a less memory-intensive option.

              I can break anything.

              1 Reply Last reply Reply Quote 0
              • M
                minph
                last edited by

                So anything configured on pfsense is saved in that one config and it will be configured exactly as it was when I just backup that one?

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

                  Yes unless you've done any customisation outside the wegui setup.

                  Steve

                  1 Reply Last reply Reply Quote 0
                  • M
                    minph
                    last edited by

                    I was just wondering, if I did. It is running for a while now and I just got to install snort. That's why I am hesitating to touch the running system and just wanted to add a partition to use it with swap.

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

                      I don't think it's going to be possible to add swap. If you Google for adding swap to NanoBSD there are a lot of people wanting to do it and some who've experimented with it. However anything I read about successfully adding it involved rebuilding the Nano image from patched FreeBSD source. Not adding it to a live system.

                      Perhaps, if you really don't want to switch to a full install, you could add space in another way. With Squid for example you can add another drive or slice and use that for cache storage instead of the default location. Often the problems with Snort are caused when it tries to update it's definition files and the result is too large. If that could be downloaded to a separate slice it may help. I'm just think aloud here.
                      If you are running Snort on a box that can take a maximum of 1GB of RAM you probably need to simply tune it more rigorously.
                      What hardware are you running?

                      Steve

                      1 Reply Last reply Reply Quote 0
                      • M
                        minph
                        last edited by

                        Maybe I am thinking too easy from a Linux-point of view where I would just create a partition with fdisk and mount it as swap.
                        I already have snort on lowmem performance but I still get out of swap space errors. Probably I will try to backup the whole disk into an image and then trying to reinstall with using an hd-install version of pfsense. If reinstalling the config-file would break up my setup, I can still restore with the backup

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

                          That sounds like a good plan.
                          You can't really compare this to a standard install of Linux or FreeBSD. It's more like OpenWRT, for example. Imagine trying to add an external SWAP drive to a SOHO router. It could be done but it's probably going to involve command line hackery and will be broken by the next update.

                          Steve

                          1 Reply Last reply Reply Quote 0
                          • jimpJ
                            jimp Rebel Alliance Developer Netgate
                            last edited by

                            Step 0: Say goodbye to anything you love on da0 and be ready to redo this when (not if) it dies.

                            : dd if=/dev/zero of=/dev/da0 bs=512 count=1
                            : fdisk -I /dev/da0
                            : tunefs -L myswap /dev/da0s1
                            : swapon /dev/ufs/myswap
                            : swapinfo -h
                            Device          1K-blocks     Used    Avail Capacity
                            /dev/ufs/myswap   1951864       0B     1.9G     0%
                            

                            Add a shellcmd to do the swapon command at boot.

                            Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                            Need help fast? Netgate Global Support!

                            Do not Chat/PM for help!

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

                              That would be to use a USB stick for swap space I take it.

                              Steve

                              1 Reply Last reply Reply Quote 0
                              • jimpJ
                                jimp Rebel Alliance Developer Netgate
                                last edited by

                                Yep.

                                Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                                Need help fast? Netgate Global Support!

                                Do not Chat/PM for help!

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